开发者

Maven dependency

开发者 https://www.devze.com 2023-01-19 13:09 出处:网络
i have a little misunderstandi开发者_如何转开发ng with one problem. I use Maven 2.0.9 Currently my project consists of several internal modules:

i have a little misunderstandi开发者_如何转开发ng 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.


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号