【问题标题】:Skip compilation in gmavenplus plugin在 gmavenplus 插件中跳过编译
【发布时间】:2016-02-07 05:59:13
【问题描述】:

我目前在 Maven 构建的大型项目中工作,该项目有许多集成测试模块,这些模块被标记为 ma​​in(非测试)源。 我正在尝试创建一个将跳过这些模块的编译的配置文件。 我希望 gmaven 插件允许“跳过”配置参数,但事实并非如此。 有没有什么方法可以跳过模块处理而不将 gmaven 插件指向不存在的目录并且无需将除集成测试之外的所有模块复制粘贴到单独的配置文件中?

【问题讨论】:

  • 不明白你的问题!你使用 org.codehaus.gmaven:groovy-maven-plugin?

标签: maven gmaven-plugin


【解决方案1】:

您可以将集成测试模块放在列出模块的父 pom 的单独配置文件中。该配置文件应该处于活动状态,除非您在运行 Maven 构建 (-DskipIntegrationTestModules) 时通过设置属性来禁用它。 (Don't use activeByDefault.)

  <modules>
    <module>my-project</module>
  </modules>

  <profiles>
    <profile>
        <id>build-integration-tests</id>
        <activation>
            <property>
                <name>!skipIntegrationTestModules</name>
            </property>
        </activation>       
        <modules>
            <module>my-project-integration-test</module>
        </modules>
    </profile>
  </profiles>

您可以在Maven Introduction to Build Profiles 中找到更多详细信息。

您还应该知道it can be dangerous to have modules in build profiles,因为在进行发布构建时它们可能会被意外遗漏。我认为在这种情况下应该没问题,因为必须明确停用配置文件。

【讨论】:

  • 抱歉问题
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-11-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多