【发布时间】:2019-09-20 09:44:34
【问题描述】:
编辑:原来我只是不擅长找东西。更改之前的战争没有这些库,并且原始 .war(重新打包之前)已经包含它们。所以问题出在其他地方,spring-boot-maven-plugin 与它无关。仍然不知道它们来自哪里,因为我也尝试过简单地删除我找到的依赖项,但是哦,好吧,看我的第一句话。
我正在努力让我的公司软件作为 Spring Boot 应用程序运行。由于我们的战争可能部署在各种不同的环境中,例如 SAP Cloud Platform,因此日志库不应包含在 lib 文件夹中以防止冲突。但是,无论我的排除有多么具体,一些日志库(特别是 jul-to-slf4j、log4j-api 和 log4j-to-self4j)总是在我的 lib 文件夹中。其他库(测试所需或必须包含在类文件中的两个库)被正确排除。
我已经尝试将标签设置为特定的库以及排除整个组。在此之后,我尝试简单地排除依赖项本身,但是在 mvn dependency:tree 告诉我它们不再存在之后它们仍然以某种方式出现。
这是插件配置:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>
repackage
</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>de.firm.integration.BaseSpringConfiguration</mainClass>
<excludes>
<exclude>
<groupId>de.firm.integration</groupId>
<artifactId>eis-generator-odata-api</artifactId>
</exclude>
<exclude>
<groupId>de.firm.integration</groupId>
<artifactId>eis-admin-ui</artifactId>
</exclude>
<exclude>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</exclude>
<exclude>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</exclude>
<exclude>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jul</artifactId>
</exclude>
<exclude>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</exclude>
<exclude>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-to-slf4j</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
我希望我构建的战争不再将这些日志库包含在我的 WEB-INF/lib 文件夹中。相反,它们一直被包括在内。
【问题讨论】:
标签: java spring spring-boot log4j slf4j