首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >maven-编译器-插件排除

maven-编译器-插件排除
EN

Stack Overflow用户
提问于 2010-06-12 20:08:03
回答 1查看 31K关注 0票数 18

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

我的pom.xml

代码语言:javascript
复制
<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>

但它不起作用:默认情况下排除-testCompile执行不会过滤这些类。如果我删除注释,那么所有匹配**/jsfunit/*.java的类都将被编译,但只有当我接触它们时才会被编译!

EN

回答 1

Stack Overflow用户

发布于 2010-09-07 14:26:43

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

代码语言:javascript
复制
<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>
票数 35
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3028612

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档