如何在没有聚合器的情况下编译多模块项目?

时间:2015-09-03 05:22:03

标签: java spring maven build build-process

如何从没有聚合器的依赖关系的主模块编译多模块项目 结构是:

Root
|-core
    |-src
    |-pom.xml
|-model
    |-src
    |-pom.xml
|-services
    |-src
    |-pom.xml
|-api
    |-src
    |-pom.xml

api / pom.xml的内容:

 <dependencies>
        <dependency>
            <groupId>com.example</groupId>
            <artifactId>services</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
 ...
 </dependencies>

命令:

root/api> mvn package

错误:

Failed to execute goal on project api: Could not resolve dependencies for project com.example:api:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: com.example:services:pom:1.0-SNAPSHOT,...

但聚合器工作正常

<?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>
    <packaging>pom</packaging>

    <parent>
        <groupId>com.example</groupId>
        <artifactId>aggregators</artifactId>
        <version>0.1.0</version>
    </parent>

    <artifactId>api-compiler</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>Compiler: API</name>

    <modules>
        <module>../../model</module>
        <module>../../core</module>
        <module>../../services</module>
        <module>../../api</module>
    </modules>

</project>

我可以在没有聚合器的情况下构建项目,也可以通过使用插件,例如&#34; maven-assembly-plugin&#34 ;? 或者我如何使用spring-boot:在多模块结构中运行 谢谢!

0 个答案:

没有答案
相关问题