Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-2640

Circular dependency in log4j-core pom.xml

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0.0
    • Component/s: None
    • Labels:
      None

      Description

      Master fails to build unless current snapshot log4j-core version is already present in local maven repo:

      [ERROR] Failed to execute goal on project log4j-core: Could not resolve dependencies for project org.apache.logging.log4j:log4j-core:jar:3.0.0-SNAPSHOT: Could not find artifact org.apache.logging.log4j:log4j-core:jar:3.0.0-SNAPSHOT, try downloading from https://logging.apache.org/log4j/2.x/download.html -> [Help 1]

      To reproduce, execute

       rm -r ~/.m2/repository/org/apache/logging/log4j

      and invoke usual mvn clean install.

      This is because log4j-core has this dependency, which itself references log4j-core (with a defined version which gets correctly overriden by 3.0.0-SNAPSHOT).

      <dependency>
         <groupId>com.github.ivandzf</groupId>
         <artifactId>log4j2-custom-layout</artifactId>
         <version>1.1.0</version>
         <scope>test</scope>
      </dependency>
      

      Simplest fix is to add exclusion:

      diff --git a/log4j-core/pom.xml b/log4j-core/pom.xml
      index 20063be15..2e15ca9a4 100644
      --- a/log4j-core/pom.xml
      +++ b/log4j-core/pom.xml
      @@ -324,6 +324,12 @@
             <artifactId>log4j2-custom-layout</artifactId>
             <version>1.1.0</version>
             <scope>test</scope>
      +      <exclusions>
      +        <exclusion>
      +          <groupId>org.apache.logging.log4j</groupId>
      +          <artifactId>log4j-core</artifactId>
      +        </exclusion>
      +      </exclusions>
           </dependency>
         </dependencies>
         <build>
      

        Attachments

          Activity

            People

            • Assignee:
              rgoers Ralph Goers
              Reporter:
              fgunbin Filipp Gunbin
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: