Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/358.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用intellij的maven错误正在引用自身_Java_Maven_Intellij Idea - Fatal编程技术网

Java 使用intellij的maven错误正在引用自身

Java 使用intellij的maven错误正在引用自身,java,maven,intellij-idea,Java,Maven,Intellij Idea,我有两个简单的pom.xml 主父项目和项目正在使用的模块 主项目pom.xml: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 htt

我有两个简单的pom.xml 主父项目和项目正在使用的模块 主项目pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">



    <modelVersion>4.0.0</modelVersion>

    <groupId>com.clouddispatcher</groupId>
    <artifactId>clouddispatcher</artifactId>
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>
    <modules>
        <module>aws-manager</module>
    </modules>
    <dependencies>
        <dependency>
            <groupId>com.clouddispatcher</groupId>
            <artifactId>aws-manager</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <properties>
        <aws.java.sdk.version>1.11.875</aws.java.sdk.version>
    </properties>
    <build>
        <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>
    <dependencyManagement>
        <dependencies>

            <dependency>
                <groupId>com.amazonaws</groupId>
                <artifactId>aws-java-sdk</artifactId>
                <version>${aws.java.sdk.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>clouddispatcher</artifactId>
        <groupId>com.clouddispatcher</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>aws-manager</artifactId>
    <dependencies>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk</artifactId>
        </dependency>
    </dependencies>
</project>
我不断地发现这个错误:

The build could not read 1 project -> [Help 1]
  
  The project com.clouddispatcher:aws-manager:1.0-SNAPSHOT (C:\Dev\my\java\clouddispatcher\aws-manager\pom.xml) has 1 error
    'dependencies.dependency. com.clouddispatcher:aws-manager:1.0-SNAPSHOT' for com.clouddispatcher:aws-manager:1.0-SNAPSHOT is referencing itself. @ com.clouddispatcher:clouddispatcher:1.0-SNAPSHOT, C:\Dev\my\java\clouddispatcher\pom.xml, line 23, column 21
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException

让我更详细地解释一下khmarbaise的观点:

  • 父级不能有Java类。您需要从父类中删除这些类
  • 不能定义循环依赖项,即如果A是B的父级,则不能将B作为依赖项

  • 您需要重构项目以满足这些标准,例如,通过将类从父模块移动到第二个模块。

    让我更详细地解释khmarbaise的要点:

  • 父级不能有Java类。您需要从父类中删除这些类
  • 不能定义循环依赖项,即如果A是B的父级,则不能将B作为依赖项

  • 您需要重构项目以满足这些条件,例如,将类从父模块移动到第二个模块。

    为什么父模块依赖于某个模块?没有意义。在父类中,im使用:AWSManager AWSManager=new AWSManager();哪一个是模块您的父模块具有打包
    pom
    功能,它不包含任何源代码,因此没有意义…最好是在github上创建一个示例项目…我添加了一个具有文件结构的图像为什么您的父模块依赖于某个模块?没有意义。在父类中,im使用:AWSManager AWSManager=new AWSManager();哪一个是模块您的父模块具有打包的
    pom
    不包含任何源代码,因此它没有意义…最好是在github上创建一个示例项目…我添加了一个具有文件结构的图像
    The build could not read 1 project -> [Help 1]
      
      The project com.clouddispatcher:aws-manager:1.0-SNAPSHOT (C:\Dev\my\java\clouddispatcher\aws-manager\pom.xml) has 1 error
        'dependencies.dependency. com.clouddispatcher:aws-manager:1.0-SNAPSHOT' for com.clouddispatcher:aws-manager:1.0-SNAPSHOT is referencing itself. @ com.clouddispatcher:clouddispatcher:1.0-SNAPSHOT, C:\Dev\my\java\clouddispatcher\pom.xml, line 23, column 21
    To see the full stack trace of the errors, re-run Maven with the -e switch.
    Re-run Maven using the -X switch to enable full debug logging.
    For more information about the errors and possible solutions, please read the following articles:
    [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException