Maven一直在给我一个关于传递依赖的警告,我不知道它来自何处!
当我运行mvn clean install时,我明白了:
[WARNING] The POM for commons-logging:commons-logging:jar:1.1.3 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
当我发出mvn依赖:tree
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ MyApp ---
[INFO] com.example:MyApp:war:2.0.0-SNAPSHOT
[INFO] +- org.springframework:spring-core:jar:4.0.3.RELEASE:compile
[INFO] | \- commons-logging:commons-logging:jar:1.1.3:compile
[INFO] +- org.springframework.integration:spring-integration-core:jar:2.0.3.RELEASE:compile
[INFO] +- org.springframework.integration:spring-integration-feed:jar:2.1.0.RELEASE:compile
[INFO] | +- net.java.dev.rome:rome-fetcher:jar:1.0.0:compile
[INFO] | | +- jdom:jdom:jar:1.0:compile
[INFO] | | +- xerces:xercesImpl:jar:2.4.0:compile
[INFO] | | +- commons-httpclient:commons-httpclient:jar:3.0.1:compile
[INFO] | | \- commons-logging:commons-logging-api:jar:1.0.4:compile
[INFO] | \- net.java.dev.rome:rome:jar:1.0.0:compile
这告诉我由于弹簧核依赖而依赖并被拉入......
但是当尝试排除它时,请使用
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
在spring-core依赖项中,出现了commons-logging-1.1.3 KEEPS的警告,也位于内部 WEB-INF / lib尝试使用以下方法将其排除:
<packagingExcludes>WEB-INF/lib/commons-logging-1.1.3.jar</packagingExcludes>
这是我的pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>MyApp</artifactId>
<version>2.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<java-version>1.7</java-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<org-springframework-version>4.0.3.RELEASE</org-springframework-version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<!-- Spring Framework -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${org-springframework-version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- other dependencies omitted to make code snippet short -->
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>${java-version}</source>
<target>${java-version}</target>
<packagingExcludes>WEB-INF/lib/commons-logging-1.1.3.jar</packagingExcludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
</project>
当我运行mvn依赖:树时,警告仍然会发生,但不会出现在stdout的任何地方!如何关闭这个烦人的警告,不要让它把这个jar带进我的WEB-INF / lib文件夹?