在maven构建期间跳过子模块 [英] Skip a submodule during a maven build

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

问题描述

我们需要在特定环境中跳过子模块。

We have a need to be able to skip a submodule in certain environments.

相关模块包含集成测试,需要半小时才能运行。因此,我们希望在CI服务器上构建时包含它,但是当开发人员在本地构建(测试运行)时,我们要跳过该模块。

The module in question contains integration tests and takes half an hour to run. So we want to include it when building on the CI server, but when developers build locally (and tests get run), we want to skip that module.

方法来做这个与配置文件设置?我已经做了一些搜索,看看其他问题/答案在这里,并没有找到一个很好的解决方案。

Is there a way to do this with a profile setting? I've done some googling and looked at the other questions/answers here and haven't found a good solution.

我想一个选择是从子模块parent pom.xml ,只需在CI服务器上添加另一个项目即可构建该模块。

I suppose one option is to remove that submodule from the parent pom.xml entirely, and just add another project on our CI server to just build that module.

建议?

推荐答案

当然,这可以使用配置文件来完成。您可以在父pom.xml中执行类似以下操作。

Sure, this can be done using profiles. You can do something like the following in your parent pom.xml.

  ...
   <modules>
      <module>module1</module>
      <module>module2</module>  
      ...
  </modules>
  ...
  <profiles>
     <profile>
       <id>ci</id>
          <modules>
            <module>module1</module>
            <module>module2</module>
            ...
            <module>module-integration-test</module>
          </modules> 
      </profile>
  </profiles>
 ...



在您的CI中,您将运行maven与 ci 配置文件,即 mvn -P ci clean install

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

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