无法将一个springboot应用程序导入另一个

时间:2019-07-08 14:19:43

标签: java spring-boot intellij-idea

我正在尝试将项目'DatabaseService'导入到IntelliJ中的另一个项目'GetUsersFunction'中。 enter image description here 尽管我仍然在'GetUsersFunction'的pom.xml文件中提到了依赖性,但是我无法构建项目。

pom.xml文件

<dependency>
  <groupId>com.session</groupId>
  <artifactId>DatabaseService</artifactId>
  <version>0.0.1-SNAPSHOT</version>
</dependency>

任何人都可以告诉我我在做什么错。完整的代码可以在这里找到-https://github.com/iftekharkhan09/AWSLamnda

1 个答案:

答案 0 :(得分:0)

根据本指南(https://www.mkyong.com/maven/maven-how-to-create-a-multi-module-project/),您需要满足以下条件:

pom.xml

<?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">
    <modelVersion>4.0.0</modelVersion>

        <!-- parent pom -->
    <groupId>com.session</groupId>
    <artifactId>UserPlanning</artifactId>
    <packaging>pom</packaging>
        <version>1.0</version>

        <!-- sub modules -->
        <modules>
        <module>DatabaseService</module>
        <module>GetUserFunctionns</module>
    </modules>
</project>

您的 DatabaseService / pom.xml

<?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 pom -->
    <parent>
        <artifactId>UserPlanning</artifactId>
        <groupId>com.session</groupId>
        <version>1.0</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.session</groupId>
    <artifactId>DatabaseService</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>
</project>

您的 GetUserFunctions / pom.xml

<?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 pom -->
    <parent>
        <artifactId>UserPlanning</artifactId>
        <groupId>com.session</groupId>
        <version>1.0</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.session</groupId>
    <artifactId>GetUserFunctionns</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>


    <dependencies>
        <dependency>
            <groupId>com.session</groupId>
            <artifactId>DatabaseService</artifactId>
            <version>1.0</version>
        </dependency>
    </dependencies>
</project>

我相信应该可以解决问题