跳过未修改模块的Maven构建? [英] Skip maven build for unmodified modules?

查看:180
本文介绍了跳过未修改模块的Maven构建?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用如下所示的Maven多模块构建

I am using maven multi module build like below

<modules>
        <module>module1</module>
        <module>module2</module>// dependant on module 1        
        <module>module3</module>// dependant on module 2
        <module>warApplication</module>// its  a war file dependant on above modules
    </modules>

当前的构建行为:- 如果我仅在模块1中进行更改,则maven甚至会构建module2,module3源文件,然后将module1,module2,module3 jar文件放在warApplication/target/lib下.

Present build behaviour :- If i make a change only in module 1, maven will build even module2, module3 source files and then put module1,module2,module3 jar files under warApplication/target/lib.

当我触发构建时,是否有配置/方式,maven会验证是否在模块下修改了任何文件,如果没有跳过该模块.对于战争档案,它将具体说明 已修改的lib文件.这样可以节省很多时间.

Is there a configuration/way when i trigger the build, maven verifies if any file was modified under the module, if no skip that module. For war file it will put specific lib file that got modified. This will save a lot of time.

要检查是否在模块下修改了任何文件,maven可以存储上次构建时间.在开始构建之前,它将检查在上次构建时间戳记之后是否修改了任何文件,如果是,则进行构建,否则跳过该文件.

To check if any file got modified under module or not, maven can store last build time . Before starting build it will check if any of the file got modified after last build timestamp, if yes build it otherwise skip it.

有没有可用的Maven插件?

Is there any maven plugin available for this ?

更新:-

我的项目结构是

TopFolder 
.mvn directory -> extensions.xml 
 build directory->build-Projects-> pom.xml 
 build directory-> parent -> pom.xml 
 modules - > module1 -> pom.xml
 modules - > module2 -> pom.xml
 modules - > module3 -> pom.xml

这是我在父pom中包含模块

Here is i am including modules in parent pom

<modules>
        <module>../../modules/module1</module>
        <module>../../modules/module2</module>
</modules>

.我在以下两个项目中都包含了scm标签<developerConnection>scm:svn:https://comp.com/svn/trunk</developerConnection>

. I have included scm tag <developerConnection>scm:svn:https://comp.com/svn/trunk</developerConnection> in both below projects

 build directory->build-Projects-> pom.xml 
 build directory-> parent -> pom.xml 

build directory->build-Projects-> pom.xml运行构建. 但是问题是当我更改任何文件的任何模块并从build directory-> pom.xml运行构建时,它没有检测到模块更改吗?

Running build from build directory->build-Projects-> pom.xml. But the issue is when I change any file any module and run build from build directory-> pom.xml, its not detecting module changes ?

推荐答案

可能最好的选择是使用增量模块构建器.在扩展文件中进行更改后的第一次,您需要mvn install,依此类推,您可以使用mvn -b incremental package,它仅构建从先前构建中更改的模块. github地址为 https://github.com/khmarbaise/incremental-module-builder

Porbably the best option is using incremental module builder. The first time after making changes in your extension file you need to mvn install and so on you can use mvn -b incremental package which just build only the modules which are changed from the previous build. The github address is https://github.com/khmarbaise/incremental-module-builder

这篇关于跳过未修改模块的Maven构建?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆