为了账号安全,请及时绑定邮箱和手机立即绑定

intellij中的Maven spring boot多模块项目在maven package

intellij中的Maven spring boot多模块项目在maven package

DIEA 2022-03-10 19:54:37
我在 IntelliJ 中有一个 Spring Boot 多模块项目,问题是,当我在 IntelliJ 中运行该项目时,它会按预期构建和工作,但是当我尝试使用 maven 包时,出现此错误:缺少POM ng.biosec:enrollment_ws:jar:0.0.1-SNAPSHOT,没有可用的依赖信息和 ng.biosec:abis_module:jar:0.0.1-SNAPSHOT缺少 POM,没有可用的依赖信息然后该过程失败。这是两个模块和父模块的 pom.xml: enrollment_ws.xmlpom<?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>integron</artifactId>        <groupId>ng.biosec</groupId>        <version>0.0.1-SNAPSHOT</version>    </parent>    <modelVersion>4.0.0</modelVersion>    <artifactId>enrollment_ws</artifactId>    <packaging>jar</packaging>    <dependencies>    </dependencies></project>这是abis_module.xmlpom 文件:<?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>integron</artifactId>        <groupId>ng.biosec</groupId>        <version>0.0.1-SNAPSHOT</version>    </parent>    <modelVersion>4.0.0</modelVersion>    <artifactId>abis_module</artifactId>    <packaging>jar</packaging></project>这是cpm.xml依赖于包含上述 pom 文件的模块的 pom 文件:<?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>integron</artifactId>        <groupId>ng.biosec</groupId>        <version>0.0.1-SNAPSHOT</version>    </parent>    <modelVersion>4.0.0</modelVersion>    <artifactId>cpm</artifactId>    <packaging>jar</packaging>
查看完整描述

1 回答

?
慕姐4208626

TA贡献1852条经验 获得超7个赞

您应该从集成模块描述符中删除元素<parent>声明并将其移至子模块。


spring-boot-maven-plugin只能在包含Spring Boot应用程序的模块中声明,即cpm模块。


在这里,集成项目描述符应该是:


<?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>


    <modules>

        <module>enrollment_ws</module>

        <module>cpm</module>

        <module>verification</module>

        <module>abis_module</module>

    </modules>


    <groupId>ng.biosec</groupId>

    <artifactId>integron</artifactId>

    <version>0.0.1-SNAPSHOT</version>

    <packaging>pom</packaging>

    <name>integron</name>

    <description>Bio Connect Project</description>


    <properties>

        <java.version>1.8</java.version>

    </properties>


    <build>

        <plugins>

            <!-- tag::wsdl[] -->

            <plugin>

                <groupId>org.jvnet.jaxb2.maven2</groupId>

                <artifactId>maven-jaxb2-plugin</artifactId>

                <version>0.13.1</version>

                <executions>

                    <execution>

                        <goals>

                            <goal>generate</goal>

                        </goals>

                    </execution>

                </executions>

                <configuration>

                    <schemaLanguage>WSDL</schemaLanguage>

                    <generatePackage>integron.client</generatePackage>

                    <schemas>

                        <schema>

                            <url>********?wsdl</url>

                        </schema>

                    </schemas>

                </configuration>

            </plugin>

            <!-- end::wsdl[] -->

        </plugins>

    </build>


    <dependencies>

        <dependency>

            <groupId>org.springframework.boot</groupId>

            <artifactId>spring-boot-starter-data-jpa</artifactId>

        </dependency>

        <dependency>

            <groupId>org.springframework.boot</groupId>

            <artifactId>spring-boot-starter-web</artifactId>

        </dependency>

        <dependency>

            <groupId>mysql</groupId>

            <artifactId>mysql-connector-java</artifactId>

            <scope>runtime</scope>

        </dependency>

        <dependency>

            <groupId>org.springframework.boot</groupId>

            <artifactId>spring-boot-starter-test</artifactId>

            <scope>test</scope>

        </dependency>

    </dependencies>

</project>

cpm模块描述符应如下所示:


<?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>

        <groupId>org.springframework.boot</groupId>

        <artifactId>spring-boot-starter-parent</artifactId>

        <version>2.1.1.RELEASE</version>

        <relativePath/> <!-- lookup parent from integron.repository -->

    </parent>

    <modelVersion>4.0.0</modelVersion>


    <artifactId>cpm</artifactId>

    <packaging>jar</packaging>


    <dependencies>

        <dependency>

            <groupId>ng.biosec</groupId>

            <artifactId>enrollment_ws</artifactId>

            <version>0.0.1-SNAPSHOT</version>

        </dependency>

        <dependency>

            <groupId>ng.biosec</groupId>

            <artifactId>abis_module</artifactId>

            <version>0.0.1-SNAPSHOT</version>

        </dependency>

        <dependency>

            <groupId>org.springframework.ws</groupId>

            <artifactId>spring-ws-core</artifactId>

        </dependency>

    </dependencies>


    <build>

    <plugins>

        <plugin>

            <groupId>org.springframework.boot</groupId>

            <artifactId>spring-boot-maven-plugin</artifactId>

        </plugin>

    </plugins>

</project>

关于wsdl生成的文件,我猜它们正在生成但未打包,因为父模块打包设置为pom。


查看完整回答
反对 回复 2022-03-10
  • 1 回答
  • 0 关注
  • 143 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信