我正在尝试创建2个zip文件,一个用于测试,另一个用于生产。 pom.xml如下所示。
<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>com.abc</groupId>
<version>1.0.0</version>
<artifactId>abc</artifactId>
<packaging>pom</packaging>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>a.abc</groupId>
<artifactId>abc1</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>a.abc</groupId>
<artifactId>abc2</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>a.abc</groupId>
<artifactId>abc3</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>b.xyz</groupId>
<artifactId>xyz1</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>b.xyz</groupId>
<artifactId>xyz2</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>b.xyz</groupId>
<artifactId>xyz3</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<finalName>app-${project.version}</finalName>
</build>
<profiles>
<profile>
<id>test</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<appendAssemblyId>true</appendAssemblyId>
<!-- <finalName>${project.name}</finalName> -->
</configuration>
<executions>
<execution>
<id>app-package-test</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptor>src/main/assembly/test-descriptor.xml</descriptor>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>a.abc</groupId>
<artifactId>abc1</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>a.abc</groupId>
<artifactId>abc2</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>a.abc</groupId>
<artifactId>abc3</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>production</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<appendAssemblyId>true</appendAssemblyId>
<finalName>${project.name}</finalName>
</configuration>
<executions>
<execution>
<id>app-package-production</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptor>src/main/assembly/production-descriptor.xml</descriptor>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>b.xyz</groupId>
<artifactId>xyz1</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>b.xyz</groupId>
<artifactId>xyz2</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>b.xyz</groupId>
<artifactId>xyz3</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
但是,当我运行 mvn clean install 时,它将构建两个配置文件
<activation>
<activeByDefault>true</activeByDefault>
</activation>
但最终的捆绑式zip包含个人资料 测试 和 制作
的依赖关系我需要通过配置文件 测试 生成的zip,以获得与 测试 配置文件相关的依赖关系以及由配置文件生成的zip 生产 ,以确定与 生产 个人资料相关的依赖关系。
任何人都知道为什么会这样吗?