Search code examples
javamavenstack-overflow

Maven Dependencies downloaded but build is failing with StackOverflowError


I am trying to migrate my existing multi-module Ant project to Maven. I have successfully generated the relevant POM files and added the correct dependencies. But for a particular module, the build is consistently failing with StackOverflowError. My Project Structure is:

OALSCMProdDataSync
|
---Properties
|
---Utilities
|
---Model
|
---RESTClient
|
---RESTServices
|
---EARModule

In this, the Properties and Utilities jars are correctly built but the Model build is consistently failing with this error:

Exception in thread "main" java.lang.StackOverflowError
    at java.util.IdentityHashMap.hash(IdentityHashMap.java:294)
    at java.util.IdentityHashMap.get(IdentityHashMap.java:328)
    at org.eclipse.aether.util.graph.transformer.ConflictResolver$ConflictContext.isIncluded(ConflictResolver.java:1062)
    at org.eclipse.aether.util.graph.transformer.NearestVersionSelector$1.accept(NearestVersionSelector.java:145)
    at org.eclipse.aether.util.graph.visitor.PathRecordingDependencyVisitor.visitEnter(PathRecordingDependencyVisitor.java:93)
    at org.eclipse.aether.graph.DefaultDependencyNode.accept(DefaultDependencyNode.java:334)

Note: The dependencies required for the Model module is correctly downloaded in my .m2 repository.

Any suggestion is appreciated. Adding the POM files of the 3 modules.

POM for Properties (Built successfully):

<?xml version="1.0" encoding="UTF-8" ?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
  <modelVersion>4.0.0</modelVersion>
  <groupId>OALSCMProdDataSync</groupId>
  <artifactId>Properties</artifactId>
  <version>1.0-SNAPSHOT</version>
  <description>Generated POM from JDeveloper for project Properties</description>
  <dependencies>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-api</artifactId>
      <version>2.6.1</version>
      <!--<type>pom</type>-->
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
      <version>2.6.1</version>
      <!--<type>pom</type>-->
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>oal.util.logger</groupId>
      <artifactId>LoggerApp</artifactId>
      <version>16.4</version>
    </dependency>
  </dependencies>
  <repositories>


      <repository>
          <id>lib_rel</id>
          <name>lib_rel</name>
          <url>https://artifactory-slc.oraclecorp.com/artifactory/libs-release</url>
      </repository>


  </repositories>
  <build>
    <sourceDirectory>src/</sourceDirectory>
    <resources>
      <resource>
        <directory>${basedir}</directory>
        <includes>
          <include>*</include>
        </includes>
      </resource>
    </resources>
    <outputDirectory>classes/</outputDirectory>
  </build>
</project>

POM for Utilities (Built successfully):

<?xml version="1.0" encoding="UTF-8" ?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
  <modelVersion>4.0.0</modelVersion>
  <groupId>OALSCMProdDataSync</groupId>
  <artifactId>Utilities</artifactId>
  <version>1.0-SNAPSHOT</version>
  <description>Generated POM from JDeveloper for project Utilities</description>
  <dependencies>
    <dependency>
      <groupId>OALSCMProdDataSync</groupId>
      <artifactId>Properties</artifactId>
      <version>1.0-SNAPSHOT</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.json</groupId>
      <artifactId>json</artifactId>
      <version>20170516</version>
    </dependency>
    <dependency>
      <groupId>com.oracle.adf.library</groupId>
      <artifactId>Java-EE</artifactId>
      <version>12.2.1-2-0</version>
      <type>pom</type>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-api</artifactId>
      <version>2.6.1</version>
      <!--<type>pom</type>-->
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
      <version>2.6.1</version>
      <!--<type>pom</type>-->
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>oal.util.logger</groupId>
      <artifactId>LoggerApp</artifactId>
      <version>16.4</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.9</version>
    </dependency>
    <dependency>
      <groupId>com.oracle.adf.library</groupId>
      <artifactId>JAX-RS-Jersey-2.x-Client</artifactId>
      <version>12.2.1-2-0</version>
      <type>pom</type>
    </dependency>
    <dependency>
      <groupId>com.oracle.em</groupId>
      <artifactId>jps-api</artifactId>
      <version>12.2.1-2-0</version>
    </dependency>
  </dependencies>
  <repositories>


      <repository>
          <id>lib_rel</id>
          <name>lib_rel</name>
          <url>https://artifactory-slc.oraclecorp.com/artifactory/libs-release</url>
      </repository>


  </repositories>
  <build>
    <sourceDirectory>src/</sourceDirectory>
    <resources>
      <resource>
        <directory>${basedir}</directory>
        <includes>
          <include>*</include>
        </includes>
      </resource>
    </resources>
    <outputDirectory>classes/</outputDirectory>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

POM for Model (Failing with StackoverflowError):

<?xml version="1.0" encoding="UTF-8" ?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
  <modelVersion>4.0.0</modelVersion>
  <groupId>OALSCMProdDataSync</groupId>
  <artifactId>Model</artifactId>
  <version>1.0-SNAPSHOT</version>
  <description>Generated POM from JDeveloper for project Model</description>
  <dependencies>
    <dependency>
      <groupId>OALSCMProdDataSync</groupId>
      <artifactId>Utilities</artifactId>
      <version>1.0-SNAPSHOT</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>OALSCMProdDataSync</groupId>
      <artifactId>Properties</artifactId>
      <version>1.0-SNAPSHOT</version>
      <type>jar</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.oracle.adf.library</groupId>
      <artifactId>TopLink</artifactId>
      <version>12.2.1-2-0</version>
      <type>pom</type>
    </dependency>
    <dependency>
      <groupId>com.oracle.adf.library</groupId>
      <artifactId>Oracle-XML-Parser-v2</artifactId>
      <version>12.2.1-2-0</version>
      <type>pom</type>
    </dependency>
    <dependency>
      <groupId>com.oracle.adf.library</groupId>
      <artifactId>BC4J-Runtime</artifactId>
      <version>12.2.1-2-0</version>
      <type>pom</type>
    </dependency>
    <dependency>
      <groupId>com.oracle.adf.library</groupId>
      <artifactId>ADF-Model-Runtime</artifactId>
      <version>12.2.1-2-0</version>
      <type>pom</type>
    </dependency>
    <dependency>
      <groupId>com.oracle.adf.library</groupId>
      <artifactId>MDS-Runtime</artifactId>
      <version>12.2.1-2-0</version>
      <type>pom</type>
    </dependency>
    <dependency>
      <groupId>com.oracle.adf.library</groupId>
      <artifactId>MDS-Runtime-Dependencies</artifactId>
      <version>12.2.1-2-0</version>
      <type>pom</type>
    </dependency>
    <dependency>
      <groupId>com.oracle.adf.library</groupId>
      <artifactId>BC4J-Security</artifactId>
      <version>12.2.1-2-0</version>
      <type>pom</type>
    </dependency>
    <dependency>
      <groupId>com.oracle.adf.library</groupId>
      <artifactId>Oracle-JDBC</artifactId>
      <version>12.2.1-2-0</version>
      <type>pom</type>
    </dependency>
    <dependency>
      <groupId>com.oracle.adf.library</groupId>
      <artifactId>BC4J-Oracle-Domains</artifactId>
      <version>12.2.1-2-0</version>
      <type>pom</type>
    </dependency>
    <dependency>
      <groupId>com.oracle.adf.library</groupId>
      <artifactId>Java-EE</artifactId>
      <version>12.2.1-2-0</version>
      <type>pom</type>
    </dependency>
    <dependency>
      <groupId>com.oracle.adf.library</groupId>
      <artifactId>EJB</artifactId>
      <version>12.2.1-2-0</version>
      <type>pom</type>
    </dependency>
    <dependency>
      <groupId>com.oracle.adf.library</groupId>
      <artifactId>ADF-Common-Runtime</artifactId>
      <version>12.2.1-2-0</version>
      <type>pom</type>
    </dependency>
    <dependency>
      <groupId>org.json</groupId>
      <artifactId>json</artifactId>
      <version>20170516</version>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-api</artifactId>
      <version>2.6.1</version>
      <!--<type>pom</type>-->
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
      <version>2.6.1</version>
      <!--<type>pom</type>-->
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>oal.util.logger</groupId>
      <artifactId>LoggerApp</artifactId>
      <version>16.4</version>
    </dependency>
  </dependencies>
  <repositories>


      <repository>
          <id>lib_rel</id>
          <name>lib_rel</name>
          <url>https://artifactory-slc.oraclecorp.com/artifactory/libs-release</url>
      </repository>


  </repositories>
  <build>
    <sourceDirectory>src/</sourceDirectory>
    <resources>
      <resource>
        <directory>${basedir}</directory>
        <includes>
          <include>*</include>
        </includes>
      </resource>
    </resources>
    <outputDirectory>classes/</outputDirectory>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

Solution

  • Resolved the issue. There was the same path for a particular artifact in 2 different remote repositories which was running into stack overflow error. Removed one of them and solved the issue.