代码之家  ›  专栏  ›  技术社区  ›  Anshul Singhal

Maven命令,不排除pom中的exclude条目

  •  1
  • Anshul Singhal  · 技术社区  · 6 年前

    <exclude> 根据 surefire 中的插件配置 pom.xml 文件

    例如-以下是来自 但我不想排除在外 TestA.java . 可以使用哪个maven命令?

    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <configuration>
        <excludes>
            <exclude>**/TestA.java</exclude>
        </excludes>
     </configuration>
    </plugin>
    
    1 回复  |  直到 6 年前
        1
  •  2
  •   Alf    6 年前

    <profiles>
        <profile>
            <id>all-tests</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <excludes>
                                <exclude></exclude>
                            </excludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    

    此配置文件覆盖surefire插件的排除部分。 只需通过以下方式激活配置文件:

    mvn clean install -Pall-tests