开发者

Add dependency without being a child module

I have 2 projects wh开发者_如何转开发ich results WAR and JAR

in Order to build WAR i need the JAR .. so i need a dependency such that when i try to build the war automatically it should build the JAR and place it in the lib(or Repository)

Help please...


---Parent POM
   |
   |-web module
   |      |
   |      --dependency of jar
   |-jar module

You need to configure multi module maven project

Also See:

  • having-a-maven-project-build-its-own-dependencies
  • Guide to Working with Multiple Modules


Normally you can just include the JAR-project as a pom-dependency.

 <dependency>
  <groupId>groupId</groupId>
  <artifactId>artifactId</artifactId>
  <version>version</version>
 </dependency>

However you might need to configure some dependency management in a POM-file where each project is as a module:

<modules>
  <module>my-project</module>
  <module>another-project</module>
</modules>

For more information see this link.

As you stated, if you don't want to use the module management you may just install the JAR with maven install. See the answer made to your last question.


I understand the title of you question "Add dependency without being a child module" in this way: you have two independent maven projects, and you do not want to put them in one project.

Build the Jar project by mvn install this put it in your local repository, then you could add it like a normal dependency to your war project.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜