tags:

views:

25

answers:

2

Hi guys, i have a little misunderstanding with one problem. I use Maven 2.0.9 Currently my project consists of several internal modules:

  1. module1 (jar)
  2. module2 (war)
  3. module3 (ear)

So i need to copy to war file in specific folder module1 jar. So what i do now : i included it via maven-dependency-plugin in package stage (copy goal). But if i didn't install module1 (mvn install) i can't build a project.

When maven-dependency-plugin looking for dependency for module1 (jar) it looks in local repository but it fail to find it because install is not made.

How can i copy dependency that is not in local repository yet but in project. Of course i can do it with the help of antmaven plugin but it is bad idea i guess.

+1  A: 

You should use copy-dependencies goal and there you can exclude unneeded dependencies. Unlike copy goal it does take jar from another module built within same reactor build without going into local or remote Maven repository.

Eugene Kuleshov
ok, but what if those dependencies are still neither local repository not remote repository. Imaging, if i'm making first build of project via mvn package. module1 is not in repository, but already in it's target folder.
I wouldn't gave you this suggestion if it didn't work :)
Eugene Kuleshov
A: 

you should set the packaging of your project to war, then all dependencies are automaticly copied to WEB-INF/lib. don't forget to add your module1 project as a dependency to the war project.

edit: are you using a parent pom? this would eliminate your problem: read http://maven.apache.org/guides/mini/guide-multiple-modules.html

Salandur