【问题标题】:log4j not getting excluded from maven buildlog4j 没有被排除在 Maven 构建之外
【发布时间】:2022-01-25 07:07:15
【问题描述】:

我希望在我的 pom 文件中排除 log4j。它甚至在远程存储库中都不可用。 我在父 pom 文件中有一个版本为 4.0.0 的属性。

<plugin>
    <groupId>net.alchim31.maven</groupId>
    <artifactId>scala-maven-plugin</artifactId>
    <version>4.3.0</version>
    <executions>
        <execution>
            <id>scala-compile-first</id>
            <phase>process-resources</phase>
            <goals>
                <goal>add-source</goal>
                <goal>compile</goal>
            </goals>
            <configuration>
                <excludes>
                    <exclude>**/log4j*</exclude>
                </excludes>
            </configuration>
        </execution>
    </executions>
</plugin>

它根本不起作用;我不断收到下面的消息。

Execution scala-compile-first of goal net.alchim31.maven:scala-maven-plugin:4.3.0:add-source failed: Plugin net.alchim31.maven:scala-maven-plugin:4.3.0 or one of its dependencies could not be resolved: Failure to find org.apache.logging.log4j:log4j-core:jar:2.11.2

【问题讨论】:

    标签: java scala maven log4j pom.xml


    【解决方案1】:

    scala-maven-plugin 中的excludes 配置部分用于过滤要编译的资源。

    在您的情况下,log4j 是一个依赖项(已编译),您必须找到在构建中拉取它的内容并从那里排除它(或设置全局依赖项排除规则)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-03-07
      • 2013-01-20
      • 2012-08-20
      • 1970-01-01
      • 2021-07-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多