Home > Mobile >  Spotify/missinglink plugin error: Multiple entries with same key: org.apache.logging.log4j.core.util
Spotify/missinglink plugin error: Multiple entries with same key: org.apache.logging.log4j.core.util

Time:12-28

I face an issue days ago and I documented the solution in StackOverflow. I hope is to use it for others.

The maven project (java version: 8) that I was working on had included spotify/misinglink plugin to detect problems coming from transitive dependency. After increasing the version of the library I had issues when running mvn clean install.

Below is the simplified pom.xml file:

<project...
  <build>
    <plugins>
      <plugin>
        <groupId>com.spotify</groupId>
        <artifactId>missinglink-maven-plugin</artifactId>
        <version>0.1.1</version>>
      <plugin>
    </plugins>
  </build>
 <dependencies>
...
  </dependencies>
</project>

After updating a log4j library and run the mvn clean install command I got the error below:

Multiple entries with same key: org.apache.logging.log4j.core.util.SystemClock=DeclaredClass{className=org.apache.logging.log4j.core.util.SystemClock, parents=[org.apache.logging.log4j.core.util.Clock, java.lang.Object], methods={MethodDescriptor{returnType=void, name=<init>, parameterTypes=[]}=DeclaredMethod{descriptor=MethodDescriptor{returnType=void, name=<init>, parameterTypes=[]}, methodCalls=[CalledMethod{owner=java.lang.Object, descriptor=MethodDescriptor{returnType=void, name=<init>, parameterTypes=[]}, lineNumber=22}], fieldAccesses=[]}, MethodDescriptor{returnType=long, name=currentTimeMillis, parameterTypes=[]}=DeclaredMethod{descriptor=MethodDescriptor{returnType=long, name=currentTimeMillis, parameterTypes=[]}, methodCalls=[CalledMethod{owner=java.lang.System, descriptor=MethodDescriptor{returnType=long, name=currentTimeMillis, parameterTypes=[]}, lineNumber=30}], fieldAccesses=[]}}, fields=[]} and org.apache.logging.log4j.core.util.SystemClock=DeclaredClass{className=org.apache.logging.log4j.core.util.SystemClock, parents=[org.apache.logging.log4j.core.time.PreciseClock, org.apache.logging.log4j.core.util.Clock, java.lang.Object], methods={MethodDescriptor{returnType=void, name=<init>, parameterTypes=[]}=DeclaredMethod{descriptor=MethodDescriptor{returnType=void, name=<init>, parameterTypes=[]}, methodCalls=[CalledMethod{owner=java.lang.Object, descriptor=MethodDescriptor{returnType=void, name=<init>, parameterTypes=[]}, lineNumber=28}], fieldAccesses=[]}, MethodDescriptor{returnType=void, name=init, parameterTypes=[org.apache.logging.log4j.core.time.MutableInstant]}=DeclaredMethod{descriptor=MethodDescriptor{returnType=void, name=init, parameterTypes=[org.apache.logging.log4j.core.time.MutableInstant]}, methodCalls=[CalledMethod{owner=java.time.Clock, descriptor=MethodDescriptor{returnType=java.time.Clock, name=systemUTC, parameterTypes=[]}, lineNumber=44}, CalledMethod{owner=java.time.Instant, descriptor=MethodDescriptor{returnType=int, name=getNano, parameterTypes=[]}, lineNumber=45}, CalledMethod{owner=java.time.Clock, descriptor=MethodDescriptor{returnType=java.time.Instant, name=instant, parameterTypes=[]}, lineNumber=44}, CalledMethod{owner=org.apache.logging.log4j.core.time.MutableInstant, descriptor=MethodDescriptor{returnType=void, name=initFromEpochSecond, parameterTypes=[long, int]}, lineNumber=45}, CalledMethod{owner=java.time.Instant, descriptor=MethodDescriptor{returnType=long, name=getEpochSecond, parameterTypes=[]}, lineNumber=45}], fieldAccesses=[]}, MethodDescriptor{returnType=long, name=currentTimeMillis, parameterTypes=[]}=DeclaredMethod{descriptor=MethodDescriptor{returnType=long, name=currentTimeMillis, parameterTypes=[]}, methodCalls=[CalledMethod{owner=java.lang.System, descriptor=MethodDescriptor{returnType=long, name=currentTimeMillis, parameterTypes=[]}, lineNumber=36}], fieldAccesses=[]}}, fields=[]}

The error was extremely unclear and I had no idea of what was causing this behavior. I commented also on this issue on github Link.

CodePudding user response:

I fixed this issue by modifying the missing link plugin like below:

  <build>
    <plugins>
      <plugin>
        <groupId>com.spotify</groupId>
        <artifactId>missinglink-maven-plugin</artifactId>
        <version>0.1.1</version>
        <executions>
          <execution>
            <phase>none</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <extensions>true</extensions>
      </plugin>
    </plugins>
  • Related