我需要从我的项目中排除依赖org.slf4j:log4j-over-slf4j。 依赖树如下所示。
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ DataImportLoader ---
[INFO] com.kipstor:DataImportLoader:jar:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.5.1.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:1.5.1.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot:jar:1.5.1.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.1.RELEASE:compile
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:1.5.1.RELEASE:compile
[INFO] | | | +- ch.qos.logback:logback-classic:jar:1.1.9:compile
[INFO] | | | | \- ch.qos.logback:logback-core:jar:1.1.9:compile
[INFO] | | | +- org.slf4j:jcl-over-slf4j:jar:1.7.22:compile
[INFO] | | | +- org.slf4j:jul-to-slf4j:jar:1.7.22:compile
[INFO] | | | \- org.slf4j:log4j-over-slf4j:jar:1.7.22:compile
[INFO] | | \- org.yaml:snakeyaml:jar:1.17:runtime
[INFO] | +- org.hibernate:hibernate-validator:jar:5.3.4.Final:compile
[INFO] | | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] | | \- com.fasterxml:classmate:jar:1.3.3:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.6:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile
[INFO] | | \- com.fasterxml.jackson.core:jackson-core:jar:2.8.6:compile
[INFO] | +- org.springframework:spring-web:jar:4.3.6.RELEASE:compile
[INFO] | | +- org.springframework:spring-aop:jar:4.3.6.RELEASE:compile
[INFO] | | +- org.springframework:spring-beans:jar:4.3.6.RELEASE:compile
[INFO] | | \- org.springframework:spring-context:jar:4.3.6.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:4.3.6.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:4.3.6.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.5.1.RELEASE:provided
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.11:provided
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.11:provided
[INFO] | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.11:provided
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.5.1.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test:jar:1.5.1.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.5.1.RELEASE:test
[INFO] | +- com.jayway.jsonpath:json-path:jar:2.2.0:test
[INFO] | | +- net.minidev:json-smart:jar:2.2.1:test
[INFO] | | | \- net.minidev:accessors-smart:jar:1.1:test
[INFO] | | | \- org.ow2.asm:asm:jar:5.0.3:test
[INFO] | | \- org.slf4j:slf4j-api:jar:1.7.22:compile
[INFO] | +- junit:junit:jar:4.12:test
[INFO] | +- org.assertj:assertj-core:jar:2.6.0:test
[INFO] | +- org.mockito:mockito-core:jar:1.10.19:test
[INFO] | | \- org.objenesis:objenesis:jar:2.1:test
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] | +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] | +- org.skyscreamer:jsonassert:jar:1.4.0:test
[INFO] | | \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] | +- org.springframework:spring-core:jar:4.3.6.RELEASE:compile
[INFO] | \- org.springframework:spring-test:jar:4.3.6.RELEASE:test
[INFO] +- org.opengis.cite.xerces:xercesImpl-xsd11:jar:2.12-beta-r1667115:compile
[INFO] | +- xml-apis:xml-apis:jar:1.4.01:compile
[INFO] | \- org.opengis.cite.eclipse.webtools.sse:org.eclipse.wst.xml.xpath2.processor:jar:1.1.5-738bb7b85d:compile
[INFO] | \- edu.princeton.cup:java-cup:jar:10k:compile
[INFO] +- org.scala-lang:scala-library:jar:2.11.0:compile
[INFO] +- com.google.code.gson:gson:jar:2.8.0:compile
[INFO] +- org.springframework.integration:spring-integration-http:jar:4.3.7.RELEASE:compile
[INFO] | \- org.springframework.integration:spring-integration-core:jar:4.3.7.RELEASE:compile
[INFO] | +- org.springframework:spring-messaging:jar:4.3.6.RELEASE:compile
[INFO] | +- org.springframework:spring-tx:jar:4.3.6.RELEASE:compile
[INFO] | \- org.springframework.retry:spring-retry:jar:1.2.0.RELEASE:compile
[INFO] +- log4j:log4j:jar:1.2.17:compile
[INFO] +- org.neo4j:neo4j-jdbc-driver:jar:3.0.1:compile
[INFO] \- org.jdom:jdom2:jar:2.0.6:compile
我尝试使用POM中的以下配置将其删除。但它似乎不起作用。任何人都可以指出这样做的正确方法吗?
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<artifactId>org.slf4j</artifactId>
<groupId>log4j-over-slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
答案 0 :(得分:4)
您的依赖声明中有印刷错误。它应该是:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>
您排除了artifactId
和groupId
元素内容。