已下载Maven依赖项,但构建失败,并出现StackOverflowError

时间:2019-05-29 11:57:34

标签: java maven stack-overflow

我正在尝试将现有的多模块Ant项目迁移到Maven。我已经成功生成了相关的POM文件并添加了正确的依赖关系。但是对于特定的模块,构建始终因StackOverflowError而失败。 我的项目结构是:

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

在这种情况下,正确构建了Properties和Utilities jar,但是Model构建始终因以下错误而失败:

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)

注意:Model模块所需的依赖项已正确下载到我的.m2存储库中。

任何建议都值得赞赏。添加3个模块的POM文件。

属性的POM(成功构建):

<?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(成功构建):

<?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(出现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>

1 个答案:

答案 0 :(得分:0)

解决了问题。 2个不同的远程存储库中的特定工件有相同的路径,该路径正遇到堆栈溢出错误。删除了其中一个并解决了问题。