Maven多模块打包问题

2019-03-08  本文已影响0人  aix91

1. 项目结构

tdk
├── tdk-server
├── tdk-api
├── tdk-inf
└── tdk-client

tdk pom

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.test</groupId>
    <artifactId>tdk</artifactId>
    <version>0.0.1</version>
    <packaging>pom</packaging>
    <modules>
        <module>tdk-api</module>
        <module>tdk-client</module>
        <module>tdk-inf</module>
        <module>tdk-server</module>
    </modules>

tdk-inf pom

    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.test</groupId>
        <artifactId>tdk</artifactId>
        <version>0.0.1</version>
    </parent>
    <packaging>jar</packaging>
    <version>0.0.1</version>
    <artifactId>tdk-inf</artifactId>

tdk-server 依赖tdk-inf

        <dependency>
            <groupId>com.ximalaya.webgroup</groupId>
            <artifactId>tdk-inf</artifactId>
        </dependency>

2. 打包问题

tdk-server依赖tdk-inf,如果要打包tdk-server,则需要将tdk-inf发布到仓库。在depoly tdk-inf到仓库后,由于它依赖tdk pom,如果tdk pom没有deploy到仓库,就会导致tdk-server的打包失败。

3. 解决办法

4. 操作方法

  <distributionManagement>
    <repository>
      <id>nexus</id>
      <name>Releases</name>
      <url>http://xxxx/repository/maven-releases</url>
    </repository>
    <snapshotRepository>
      <id>nexus</id>
      <name>Snapshot</name>
      <url>http://xxxx/repository/maven-snapshots</url>
    </snapshotRepository>
  </distributionManagement>
<properties>
    <maven.deploy.skip>true</maven.deploy.skip>
</properties>
上一篇 下一篇

猜你喜欢

热点阅读