On 2011-10-16 12:04, Barrie Treloar wrote:
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]
You are right about the


Thanks for the answer, I appreciate it!

You are right about the install command, I wrote it a bit too quickly when I said package. But I still have the same queation, shouldn't it be possible to execute mvn eclipse:eclipse to create the eclipse projects without an initial build which would be the result of mvn install?

A mvn install followed of a mvn eclipse:eclipse works as the dependencies then can be found in the local repo. But if there for example were some configuration that should be applied to the newly created project (which there isn't in this case, of course) would it be more preferable if the mvn install could wait until the project is ready for its first build. Well, if the initial mvn install always is necessary do I have to get used to it and accept that it is that way it works.

The dubug command reveals that I use version 2.8 of the eclipse-plugin:

Resolved plugin version for org.apache.maven.plugins:maven-eclipse-plugin to 2.8 from repository central (http://repo1.maven.org/maven2, releases

And I use Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100) and Java 1.6.0

Jonny Andersson

Reply via email to