aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven 2, Eclipse and J2EE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven 2, Eclipse and J2EE" Watch "Maven 2, Eclipse and J2EE" New topic
Author

Maven 2, Eclipse and J2EE

Pulpit Rock
Greenhorn

Joined: Oct 31, 2006
Posts: 1
Hi!

I'm building a new project and aim to use Maven2, J2EE and Eclipse.
I've had a look at the Maven website trying to find answers to some of
my questions, but have not been successful. I hope somebody out there
has experience in this combination and can help me.

My questions are:

1. How should I create the initial project (directory structures etc)?
Should I use Maven to do it, or do it manually?
2. Does the project structure need to have a certain layout to be
supported by Maven2?
3. What files do I commit in CVS? There will be multiple users working
on the project. Do I include the Eclipse project files or do I let
Maven2 recreate them when new users gets the source?

If anybody could give me a step-by-step instruction on how to go from A
to Z in this, I would be very thankful (from creating the project
structure, importing it into Eclipse and committing/getting the files
from CVS). Not very detailed but high-level...
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

Maven and I are not the best of friends, but:

1. I recommend you use the Maven archetype facility to start a Maven project. It'll create the basic directory structure and prototype files.

2. You don't have to use a specific directory structure, but life will be a lot more fun if you do, since otherwise you have to manually override the defaults. Besides, one of Maven's big selling points is that projects do have a common structure.

3. I commit everything that can't be built, Maven or not. I often will additionally commit the end products and stuff that's generated that's too much trouble to regenerate on each and every build. Eclipse projects can be portable, so I commit them. The idea is that in the event of panic, I can get A) the deployable stuff B) the stuff that does a fast build C) the stuff that can build everything from the ground up. In that order.


Customer surveys are for companies who didn't pay proper attention to begin with.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

Oh and by the way, If your name really is Pulpit Rock, I'd like to hear the story. If it's fictitious, however, please note that we have a policy on names at http://www.javaranch.com/name.jsp - it's part of how we maintian the fiction that we're all a bunch of professionals here.
Sven Stilleben
Greenhorn

Joined: Nov 08, 2006
Posts: 1
Have you seen this: Maven 2 book ?

This book is an excellent resource for anyone working with Maven 2.

1)I agree, use the mvn archetype:create goal to create the initial project structure. You might need to generate several subprojects, under you parent project. This works fine in Maven 2.

2) Use mvn -DdownloadSource=true eclipse:eclipse to generate .project and .classpath files for Eclipse. Use -downloadSources=true so that the source files will be downloaded together with the main artifact from the central repository.

3)We don't commit the .project and .classpath files to Subversion/CVS, but then again not everybody on our project uses Eclipse.

Br,
Sven
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

Welcome to the Ranch, Sven!

Lately a number of good books have been showing up about Maven. I'm even beginning to finally take to Maven myself (it only took 3 years!). Between the architectural improvements that came in with Maven 2 and better docs, I no longer feel like Maven is unpredictable "magic" and amd beginning to appreciate what it does for me.

I do recommend committing Eclipse .project and .classpath files to CVS. And, if you have IntelliJ fans, the IPR and IML (but not IWS) files from them as well. They're not that big, done right, they'll not only work on different people's filesystem setups but on different OS'es, and it saves time having to reconstruct them at need.

I was working not long ago with a group of people who were trying to sell me some of their favorite apps and development tools. A primary reason they failed was because they didn't keep permanent copies of their build environments in CVS. It was simply too much trouble to construct my own when I hadn't yet seen convincing evidence that their stuff was worth the effort. If the buy-in cost had been lower, things might have been much different.
 
Consider Paul's rocket mass heater.
 
subject: Maven 2, Eclipse and J2EE