【问题标题】:Grails Unit Testing occurring on Wrong Phase of Maven Life CycleGrails 单元测试发生在 Maven 生命周期的错误阶段
【发布时间】:2016-06-06 16:54:40
【问题描述】:

我正在尝试在 Grails 应用程序上运行单元测试,它们恰好在我们的 maven 生命周期的验证阶段而不是测试阶段运行(要清楚 maven 生命周期为:“干净”- >“验证”->“编译”->“测试”->“包”->“验证”->“安装”->“站点”->“部署”)。有没有办法将负责测试的插件(即 grails:test-app)重新关联到“测试”阶段?

【问题讨论】:

    标签: maven unit-testing grails


    【解决方案1】:

    如果你从执行插件运行 grails 测试,你可以指定阶段:

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.4.0</version>
                <executions>
                    <execution>
                        <id>Unit-test-app</id>
                        <phase>test</phase>
                        <configuration>
                            <executable>grails</executable>
                            <commandlineArgs>test-app -unit --non-interactive </commandlineArgs>
                        </configuration>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
         </plugins>
    </build>
    

    【讨论】:

      猜你喜欢
      • 2022-11-11
      • 1970-01-01
      • 2013-05-05
      • 2016-08-05
      • 2021-01-25
      • 1970-01-01
      • 2015-04-29
      • 2016-02-18
      • 1970-01-01
      相关资源
      最近更新 更多