On Sun, Oct 16, 2011 at 8:15 PM, Jonny Andersson <[email protected]> wrote: > For single module projects I already have come to really love Maven as a > build tool but I have not yet got there when it come to Java EE projects. > With some help do I however I can get there for Java EE projects soon. This > question have maybe already been asked some times before but I have not > > 1. Create a Maven J2EE simple project > > mvn archetype:generate -DarchetypeArtifactId=maven-archetype-j2ee-simple > -DarchetypeVersion=1.0 -DgroupId=maven.example.app -DartifactId=mvn-j2ee-app > -Dversion=0.01-SNAPSHOT > > 2. Change directory into the created project > > cd mvn-j2ee-app > > 3. Open the generated root POM and delete <module>site</module> as there is > no sub folder (module/sub project) site > > 4. Execute mvn eclipse:eclipse to build eclipse projects for all the modules > > 5. Beside a number of warnings on missing versions for plugins as the > archetype seems to lack updates for Maven 3 an error occur: > > [ERROR] Failed to execute goal on project ear: Could not resolve > dependencies for project root.project:ear:ear:1.0: The following artifacts > could not be resolved: root.project:ejbs:jar:1.0, > root.project.servlets:servlet:war:1.0, root.project:primary-source:jar:1.0, > root.project.projects:logging:jar:1.0: Failure to find > root.project:ejbs:jar:1.0 in http://repo1.maven.org/maven2 was cached in the > local repository, resolution will not be reattempted until the update > interval of central has elapsed or updates are forced -> [Help 1] > > Of course, there is no artifacts built until a mvn package is executed. But > shouldn't it be possible to execute a mvn eclipse.eclipse on a newly > generated Maven J2EE simple project without this error? Or should it at > least not be possible to get around it in some way? > > I have not been able to find a solution to this and I think it would be more > appropriate if it were possible to create a new Java EE project from an > archetype like this one and only execute mvn eclipse:eclipse and then begin > to work with the modules before any first build is done. What I want as a > start is a simple multi module project that builds an EAR with a web module > and an EJB module. > > With thanks and appreciation for any help to solve this > Jonny Andersson >
Just run this first mvn install (package is not good enough as it does not install anything into your local repository) That will get you going for now. After "install'' all your dependencies for your current project are available for eclipse:eclipse to work on. Now the next question is, why isn't eclipse:eclipse picking up the fact that it should be using project references instead of m2/repo references. As use project references is the default value: http://maven.apache.org/plugins/maven-eclipse-plugin/eclipse-mojo.html#useProjectReferences Can you run mvn -X eclipse:eclipse and find out what version of the plugin is being used? I wont be able to try the archetype command until tomorrow to see what happens myself. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
