maven插件覆盖不起作用

时间:2018-03-15 23:35:15

标签: java maven jar

我在父pom中有一个插件,代码如下:

        <!-- Test Plugin -->
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>${surefire.plugin.version}</version>
      <configuration>

        <!-- Used for JaCoCo Plugin -->
        <argLine>${surefireArgLine}</argLine>

        <!-- Used for SonarQube Analysis -->
        <reportsDirectory>../target/surefire-reports</reportsDirectory>

      </configuration>
    </plugin>

在子pom中,我想在测试范围的构建路径中排除javaee-api.jar,如下所示。

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration combine.self="override">
              <classpathDependencyExcludes>
                <classpathDependencyExclude>javax:javaee-api</classpathDependencyExclude>
              </classpathDependencyExcludes>
            </configuration>
          </plugin> 

但是javaee-api.jar仍然在类路径中显示。有什么想法?

  

ons-collections4 \ 4.1 \ commons-collections4-4.1.jar,C:\ Users \ y2944.m2 \ repository \ commons-dbutils \ commons-dbutils \ 1.6 \ commons-dbutils-1.6.jar,C:\ Users \ y2944.m2 \ repository \ log4j \ log4j \ 1.2.17 \ log4j-1.2.17.jar,C:\ Users \ y2944.m2 \ repository \ javax \ faces   \ javax.faces-api \ 2.1 \ javax.faces-api-2.1.jar,C:\ Users \ y2944.m2 \ repository \ javax \ servlet \ javax.servlet-api \ 3.0.1 \ javax.servlet-api- 3.0.1.jar,C:\ Users \ y2944.m2 \ repository \ com \ csx \ services \ xx \ nas-engine-api \ 1.1.0 \ nas-engine-api-1.1.0.jar,C:\用户\ÿ   2944.m2 \ repository ** javax \ javaee-api \ 7.0 ** \ javaee-api-7.0.jar,C:\ Users \ y2944.m2 \ repository \ com \ sun \ mail \ javax.mail \ 1.5.0 \ javax.mail-1.5.0.jar,C:\ Users \ y2944.m2 \ repository \ javax \ activation \ activation \ 1.1 \ activation-1.1.jar,C:\ Users \ y2944.m2 \ reposi   tory \ org \ apache \ commons \ commons-lang3 \ 3.1 \ commons-lang3-3.1.jar,C:\ Users \ y2944.m2 \ repository \ commons-io \ commons-io \ 1.3.2 \ commons-io-1.3 .2.jar,C:\ Users \ y2944.m2 \ repository \ org \ primefaces \ primefaces \ 6.0.18 \ primefaces-6.0.18.jar,C:\ Users \ y2944.m2 \   repository \ org \ apache \ poi \ poi-ooxml \ 3.10.1 \ poi-ooxml-3.10.1.jar,C:\ Users \ y2944.m2 \ repository \ org \ apache \ poi \ poi \ 3.10.1 \ poi -3.10.1.jar,C:\ Users \ y2944.m2 \ repository \ org \ apache \ poi \ poi-ooxml-schemas \ 3.10.1 \ poi-ooxml-schemas-3.10.1.jar,C:\ Users \ Y294   4.m2 \ repository \ org \ apache \ xmlbeans \ xmlbeans \ 2.6.0 \ xmlbeans-2.6.0.jar,C:\ Users \ y2944.m2 \ repository \ dom4j \ dom4j \ 1.6.1 \ dom4j-1.6.1 .jar,C:\ Users \ y2944.m2 \ repository \ org \ apache \ xmlbeans \ xmlbeans-qname \ 2.6.0 \ xmlbeans-qname-2.6.0.jar,C:\ Users \ y2944。   平方米\库\组织\阿帕奇\的xmlbeans \的xmlbeans-xmlpublic \ 2.6.0 \的xmlbeans-xmlpublic-2.6.0.jar]

1 个答案:

答案 0 :(得分:0)

javaee-api.jar的问题只有接口,没有实现。排除并没有奏效。所以我在测试范围上添加了实现。

   <dependency>
      <groupId>org.glassfish</groupId>
      <artifactId>javax.faces</artifactId>
      <version>2.3.3</version>
      <scope>test</scope>
    </dependency>`