2017-05-09 85 views
0

上下文:Maven。只构建部署配置文件的模块

我有一个相当大的系统,其中包含几个在层次结构中形成的maven模块。当我需要开发我可以去根和建立使用特定的配置文件-Pdeploy

这样做的问题是,我的整个项目是建立(这需要一段时间),当我只有在事实上需要建立一个只需部署一些轻量级模块。

我应该如何在部署时提高团队的效率?

回答

0

基本构思:您不能跳过构建模块,但可以跳过一些包含的插件执行。

通常您的存储库已经有构建模块工件,所以一旦先前的构建已经运行并且可以从那里取出模块工件,整体速度应该已经更好。

这个想法是,您根据您在执行部署配置文件构建时可能想省略的内容添加一个定义跳过属性的配置文件设置。

<profiles> 
    <profile> 
     <id>default</id> 
     <activation> 
     <activeByDefault /> 
     </activation> 
     <properties> 
     <skip.documentation>false</skip.documentation> 
     <skip.sign>false</skip.sign> 
     <skip.sources>false</skip.sources> 
     <skip.checks>false</skip.checks> 
     <skip.reports>false</skip.reports> 
     <skip.installer>false</skip.installer> 
     </properties> 
    </profile> 

    <profile> 
     <id>deploy</id> 
     <properties> 
     <skip.documentation>true</skip.documentation> 
     <skip.sign>true</skip.sign> 
     <skip.sources>true</skip.sources> 
     <skip.checks>true</skip.checks> 
     <skip.reports>true</skip.reports> 
     <skip.installer>true</skip.installer> 
     </properties> 
    </profile> 
    </profiles> 

你的POM比可能包含

<plugin> 
    <artifactId>maven-checkstyle-plugin</artifactId> 
    <version>${version.maven-checkstyle-plugin}</version> 
    <configuration> 
    <skip>${skip.checks}</skip> 
    </configuration> 
</plugin> 

这种方法可以在一个项目POM水平(pluginDependencies)或每个模块中重写应用。