У меня есть тест-модуль 3 проекта Maven POM с двумя зависимостями: Зависимый тест-модуль1 и Зависимый тест-модуль2.
Зависимость test-module2 также имеет test-module1 в качестве зависимости с областью действия, установленной для компиляции, но у нее нет настроенного подключаемого модуля Maven Shade или подключаемого модуля Maven Assembly.
Теперь я хочу построить зависимый test-module2 с использованием test-module3. Поэтому я настраиваю плагин Maven Assemby. Это прекрасно работает. Но тест-модуль зависимостей1 отсутствует в тест-модуле зависимостей2.
Как настроить плагин Maven Assemby или любой другой плагин test-module3 так, чтобы он затенял test-module1 в test-module2?
Вот мои 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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>test</groupId>
<artifactId>test-project</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>test-distribution</artifactId>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>test</groupId>
<version>${project.version}</version>
<artifactId>test-module1</artifactId>
</dependency>
<dependency>
<groupId>test</groupId>
<version>${project.version}</version>
<artifactId>test-module2</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assembly/distribution.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
distribution.xml:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>distribution</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
</dependencySet>
</dependencySets>
</assembly>
POM тест-модуля1:
<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>test</groupId>
<artifactId>test-project</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>test-module1</artifactId>
<packaging>jar</packaging>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>
POM тест-модуля2:
<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>test</groupId>
<artifactId>test-project</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>test-module2</artifactId>
<packaging>jar</packaging>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>test</groupId>
<artifactId>test-module1</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
Моя цельпоместить test-module1 в папку ZIP, а test-module2 - в папку ZIP, но test-module2 также должен содержать test-module1.