これは少し不格好ですが、maven-dependency-plugin を使用してすべての依存関係をプロジェクトにコピー/アンパックし、アセンブリ プラグインを使用してパッケージ化を行うことができます。
copy-dependencies
とゴールのunpack-dependencies
両方に、依存関係を省略するために設定できるオプションのexcludeScopeプロパティがあります。provided
以下の構成は、すべての依存関係を target/lib にコピーします。アセンブリ プラグイン記述子を変更して、fileSetを使用してこれらの jar を含めることができます。
更新:これをテストして、動作することを確認しました。アセンブリ プラグインをパッケージ フェーズにバインドするための構成と、アセンブリ記述子への関連する変更を追加しました。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>process-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<excludeScope>provided</excludeScope>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-4</version>
<executions>
<execution>
<id>jar-with-deps</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptors>
<descriptor>src/main/assembly/my-assembly.xml</descriptor>
</descriptors>
</configuration>
</plugin>
記述子の fileSet セクションは次のmy-assembly
ようになります。
<assembly>
<fileSets>
<fileSet>
<directory>${project.build.directory}/lib</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>*.*</include>
</includes>
</fileSet>
</fileSets>
...
</assembly>