Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Maven编译器插件重新编译测试,同时将Maven.test.skip设置为true_Maven_Maven 3_Pom.xml_Maven Compiler Plugin - Fatal编程技术网

Maven编译器插件重新编译测试,同时将Maven.test.skip设置为true

Maven编译器插件重新编译测试,同时将Maven.test.skip设置为true,maven,maven-3,pom.xml,maven-compiler-plugin,Maven,Maven 3,Pom.xml,Maven Compiler Plugin,更新pom.xml文件以使用较新的maven编译器版本,3.6.0并传递-D=maven.test.skip=true选项时,实际上不会跳过测试编译 基于以下POM样本: <project> <modelVersion>4.0.0</modelVersion> <groupId>com.sample</groupId> <artifactId>sample-compiler</artifactId>

更新
pom.xml
文件以使用较新的
maven编译器版本
3.6.0
并传递
-D=maven.test.skip=true
选项时,实际上不会跳过测试编译

基于以下POM样本:

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.sample</groupId>
  <artifactId>sample-compiler</artifactId>
  <version>0.0.1-SNAPSHOT</version>

  <build>
    <pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.0</version>
            </plugin>
        </plugins>
    </pluginManagement>
  </build>

  <dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
    </dependency>
  </dependencies>
</project>
将产生:

[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) @ sample-compiler ---  
[INFO] Not compiling test sources  
[INFO]  
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ sample-compiler ---  
[INFO] Tests are skipped.  
但是,当升级到
3.6.0
并调用与上述相同的命令时,我们将:

[INFO] --- maven-compiler-plugin:3.6.0:testCompile (default-testCompile) @ sample-compiler ---
[INFO] Not compiling test sources   
[INFO] Changes detected - recompiling the module!   
[INFO] Compiling 1 source file to C:\data\eclipse-workspace\sample-compiler\target\test-classes  
[INFO]  
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ sample-compiler ---  
[INFO] Tests are skipped.  
注意检测到的附加
更改-重新编译模块
意味着实际上忽略了
maven.test.skip
标志


问题:这是一个回归还是在上述过程中遗漏了什么?

当我试图将其作为错误报告发布时,我发现它实际上已经被报告了:

  • maven.test.skip
    不跳过测试编译
因此,这可能是一种倒退,有待Maven团队进一步证实


需要注意的重要事项:将
跳过
测试传递给
测试编译
目标(默认情况下通过默认绑定执行)时会发生相同的行为,如下所示(覆盖其默认id,
默认测试编译
):




中也有报道。也许是回归是的。@Tunaki是的,我几分钟后就意识到了。我应该先检查一下它的JIRA而不是我的bad@Tunaki那么,我是否应该删除这个问题?最好将其保留在我的记忆中,这样可能是有相同问题的人第一次去的地方。也可以作为dupe目标。很好的一点,Google在搜索它时确实没有帮我(Maven JIRA很可能没有这么好的索引)。我想知道,如果POM中为
testCompile
目标显式配置了
,它能工作吗?是的,同样的行为,刚刚测试过。要发布更新才能确认回归。推动了一个将包含在3.6.1中的修复。@Tunaki对那些说“Maven死了”的人说,我会很快回答“你错了!那里最好的开发人员之一刚刚加入了它的团队,未来是光明的!”。顺便说一句,周一罗伯特·斯科尔特(Robert Scholet)将在比利时Devxx做一个关于Java 9和Maven的演讲,我将在那里和他见面:)Maven万岁!令人惊叹的!我也很想去那里:)
[INFO] --- maven-compiler-plugin:3.6.0:testCompile (default-testCompile) @ sample-compiler ---
[INFO] Not compiling test sources   
[INFO] Changes detected - recompiling the module!   
[INFO] Compiling 1 source file to C:\data\eclipse-workspace\sample-compiler\target\test-classes  
[INFO]  
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ sample-compiler ---  
[INFO] Tests are skipped.  
<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.0</version>
                <executions>
                    <execution>
                        <id>default-testCompile</id>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </pluginManagement>
</build>