开发者

Building Products with Maven

I'm fairly new to Maven and I'd like to use it to build a multi-module project.

Lets assume I have the following svn repository structure:

 - /trunk/common-services/login-service
   (.jar) [re-usable components]  
 - /trunk/services/mybusiness-service
   (.jar)
 - /trunk/webservices/mybusiness-rest
   (.war) 
 - /trunk/products/myproduct
   (pom) [issue mvn command here]

What I'd like to be able to do is to checkout and build the entire "product" from a single pom using a single mvn command (from a developers pov as well as a CI pov). It's safe to assume that I have the trunk checked out.

How do I do this using Maven? I've looked at the Maven reactor plugin, but I 开发者_C百科can't figure out how to use it correctly (if it is the correct plugin to use).


The reactor plugin assumes each module has its pom.xml.

For your use case, you would want to create a pom.xml for each module (login-service, mybusiness-service and mybusiness-rest). You would specify the dependencies in each of the modules. For instance, if your mybusiness-rest depends on login-service and mybusiness-service, you would specify these projects as dependencies.

You would have a pom.xml in /trunk which specifies each of the modules to be built. You can use the reactor features in this pom.xml to determine, when to build (or not build) specific modules.

Your developers and CI can build using this single pom.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜