一、假设有四个Maven项目
1、soa-dub-parent:父项目
1
2
3
4
5
|
<
modules
>
<
module
>../soa-dub-facade</
module
>
<
module
>../soa-dub-service</
module
>
</
modules
>
|
3、soa-dub-facade:服务接口项目
1
2
3
4
5
6
|
<
parent
>
<
artifactId
>soa-dub-parent</
artifactId
>
<
groupId
>com.cn</
groupId
>
<
version
>0.0.1-SNAPSHOT</
version
>
<
relativePath
>../soa-dub-parent/pom.xml</
relativePath
>
</
parent
>
|
4、
soa-dub-service
:服务实现项目
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
<
parent
>
<
artifactId
>soa-dub-parent</
artifactId
>
<
groupId
>com.cn</
groupId
>
<
version
>0.0.1-SNAPSHOT</
version
>
<
relativePath
>../soa-dub-parent/pom.xml</
relativePath
>
</
parent
>
<
modelVersion
>4.0.0</
modelVersion
>
<
artifactId
>soa-dub-service</
artifactId
>
<
packaging
>jar</
packaging
>
<
name
>soa-dub-service</
name
>
<
dependencies
>
<
dependency
>
<
groupId
>com.cn</
groupId
>
<
artifactId
>soa-dub-facade</
artifactId
>
<
version
>0.0.1-SNAPSHOT</
version
>
</
dependency
>
</
dependencies
>
|
需求:构建Maven_Service项目时先构建其它项目
二、Jenkins操作步骤:
1、创建一个Maven的Job
2、Subversion指向所有项目的根地址
3、Build的Root Pom指向
soa-dub-parent
的pom.xml(注意路径)

4、注意文件的相对路径
三、执行逻辑
soa-dub-parent的pom.xml执行clean install命令,soa-dub-parent会根据module依次clean install子模块(soa-dub-facade,soa-dub-service)