1 つの依存関係とそのすべての推移的な依存関係を指定したフォルダーにコピーする必要があります。「excludeArtifactIds」でアーティファクトを除外できることはわかっていますが、それらのアーティファクトの推移的な依存関係も除外する必要があります。
これを行う方法はありますか?
1 つの依存関係とそのすべての推移的な依存関係を指定したフォルダーにコピーする必要があります。「excludeArtifactIds」でアーティファクトを除外できることはわかっていますが、それらのアーティファクトの推移的な依存関係も除外する必要があります。
これを行う方法はありますか?
Maven依存関係プラグインは、この機能に対する1つのリクエストを「WONTFIX」として閉じ、2007年以降、別のリクエストがOPENになっているため、このために設計されていないようです。
ただし、maven-assembly-pluginを使用して同様のタスクを実行できます。
以下に2つのサンプルPOMを添付しました。1つ目は、依存関係のあるプロジェクト(コピーしたいプロジェクト)であり、それ自体に1つの依存関係があります(たとえば)。2つ目は、他のプロジェクトとその依存関係をコピーする集約プロジェクトです。依存関係をコピーするために使用するアセンブリ記述子ファイルも添付しました。
基本的に、これは最初のプロジェクトをコピーし、2番目のプロジェクトのターゲット/宛先(構成可能)ディレクトリーへの1つの依存関係です。
最初のPOM(依存プロジェクト):/sample-dependency/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>sample-dependency</groupId>
<artifactId>sample-dependency</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.5</version>
</dependency>
</dependencies>
</project>
2番目のPOM(集約プロジェクト):/ sample-dependency-aggregator / 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>sample-dependency-aggregator</groupId>
<artifactId>sample-dependency-aggregator</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>sample-dependency-aggregator</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>aggregate</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptor>src/main/assembly/default.xml</descriptor>
</configuration>
</execution>
</executions>
<configuration>
<attach>false</attach>
<finalName>dest</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>sample-dependency</groupId>
<artifactId>sample-dependency</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
アセンブリ記述子:/sample-dependency-aggregator/src/main/assembly/default.xml
<?xml version="1.0" encoding="UTF-8"?>
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.1 http://maven.apache.org/xsd/assembly-1.1.1.xsd ">
<id>default</id>
<formats>
<format>dir</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<includes>
<include>sample-dependency:sample-dependency</include>
</includes>
<useTransitiveDependencies>true</useTransitiveDependencies>
<useTransitiveFiltering>true</useTransitiveFiltering>
</dependencySet>
</dependencySets>
</assembly>
excludeTransitiveを に設定するのはどうtrue
ですか?