gpt4 book ai didi

compilation - maven-compiler-plugin排除

转载 作者:行者123 更新时间:2023-12-03 19:55:23 28 4
gpt4 key购买 nike

我有以下问题。
我想在测试编译阶段排除一些.java文件(** / jsfunit / *。java),另一方面,我想在编译阶段包括它们(id我使用tomcat启动tomcat:运行目标) )

我的pom.xml

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<!-- <excludes>
<exclude>**/*JSFIntegration*.java</exclude>
</excludes> -->
</configuration>
<executions>
<!-- <execution>
<id>default-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<includes>
<include>**/jsfunit/*.java</include>
</includes>
</configuration>
</execution>-->
<execution>
<id>default-testCompile</id>
<phase>test-compile</phase>
<configuration>
<excludes>
<exclude>**/jsfunit/*.java</exclude>
</excludes>
</configuration>
<goals>

<goal>testCompile</goal>
</goals>
</execution>
</executions>

</plugin>


但这是行不通的:在default-testCompile中,exclude不会过滤这些类。
如果删除注释,则所有与** / jsfunit / *。java匹配的类都将被编译,但只有当我触摸它们时才可以编译!

最佳答案

要从default-testCompile阶段中排除文件,必须使用<testExcludes>。因此,您上面的示例如下所示:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
<executions>
<execution>
<id>default-testCompile</id>
<phase>test-compile</phase>
<configuration>
<testExcludes>
<exclude>**/jsfunit/*.java</exclude>
</testExcludes>
</configuration>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>

关于compilation - maven-compiler-plugin排除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3028612/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com