我正在尝试将maven项目部署到私有工件存储库,但是maven生成了两个版本不同的jar:
mvn deploy
为什么Maven为一个部署任务生成了两个jar?这是故意的行为还是错误?我的项目有一个带四个子jar模块的父pom。
我的父母pom:
<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>org.codingfarm.jsop</groupId>
<artifactId>jsop-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<description>SOP协议Java实现,Maven父工程。</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<modules>
<module>jsop-core</module>
<module>jsop-client</module>
<module>jsop-server</module>
<module>jsop-bgzchina</module>
</modules>
<build>
<!-- pluginManagement 中定义的插件将被所有模块继承 -->
<pluginManagement>
<plugins>
<!-- 统一指定源码级别和编码,个别子模块可以覆盖 -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<!-- 新版的Maven本身可能需要java 8才能运行,因此编译过程需要单独指定jdk toolchain,个别子模块可以覆盖 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<goals>
<goal>toolchain</goal>
</goals>
</execution>
</executions>
<configuration>
<toolchains>
<jdk>
<version>1.6</version>
<vendor>sun</vendor>
</jdk>
</toolchains>
</configuration>
</plugin>
<!-- Maven项目不再单独使用PMD P3C CheckStyle 之类的静态代码扫描,统一由SonarQube完成 -->
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.6.0.1398</version>
</plugin>
<!-- 统一Site插件,生成构建报告 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
<configuration>
<locales>zh_CN</locales>
</configuration>
</plugin>
<!-- 测试覆盖率检测 -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.3</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
<!-- 依赖管理 -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<!-- #### 贵州银行相关 #### -->
<!-- Tuxedo Jolt -->
<dependency>
<groupId>shared</groupId>
<artifactId>jolt</artifactId>
<version>1.0</version>
</dependency>
<!-- 通讯管理平台API -->
<dependency>
<groupId>cmp</groupId>
<artifactId>CMP_API</artifactId>
<version>20180511</version>
</dependency>
<!-- #### 单元测试 #### -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.stefanbirkner</groupId>
<artifactId>system-rules</artifactId>
<version>1.19.0</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
<distributionManagement>
<repository>
<id>central</id>
<name>37382422b2a3-releases</name>
<url>http://localhost:8081/artifactory/local</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>37382422b2a3-snapshots</name>
<url>http://localhost:8081/artifactory/local</url>
</snapshotRepository>
</distributionManagement>
</project>
和子模块pom之一:
<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>
<groupId>org.codingfarm.jsop</groupId>
<artifactId>jsop-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>jsop-client</artifactId>
<description>SOP协议客户端实现</description>
<dependencies>
<dependency>
<groupId>org.codingfarm.jsop</groupId>
<artifactId>jsop-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
</dependencies>
</project>