プロジェクトをビルドするときにmaven-assembly-pluginを使用してプロジェクトのzipファイルを作成しています。それは成功です。今私が望むのは、プロジェクト内の特定のディレクトリだけを圧縮することです。mavenアセンブリプラグインを使用して特定のディレクトリのみを解凍する方法
これは以前使用したpomのプラグインのコードです。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>make shared resources</id>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
<configuration>
<descriptors>
<descriptor>resource.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
また、resource.xmlファイルは次のとおりです。
<assembly>
<id>resources</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<!-- Since it bundles all the units -->
<directory></directory>
<outputDirectory>/project</outputDirectory>
<excludes>
<exclude>pom.xml</exclude>
<exclude>*.iml</exclude>
<exclude>*.jar</exclude>
<exclude>**/src/**</exclude>
<exclude>**/target/**</exclude>
<exclude>resource.xml</exclude>
</excludes>
</fileSet>
</fileSets>
</assembly>
私は、Mavenビルドでプロジェクトのいくつかのディレクトリのみを圧縮したいと思っています。
例として、私はプロジェクトで次のフォルダ構造を持っています。
project
|_directories
|_dir1
|_ ....
|_dir2
|_ ....
|_dir3
|_ ....
|_pom.xml
私が望むのは、ディレクトリフォルダのみを含むmake zipファイルです。私のzipファイルを抽出するときには、その中に4つのディレクトリだけが含まれているはずです。
どうすればこの問題を解決できますか? これを行うには、maven-assembly-pluginで十分ですか?またはmojoを作成する必要がありますか?
あなたは明示的に 'include'タグを使って名前を付けてみましたか? https://maven.apache.org/guides/mini/guide-assemblies.html – user1717259
あなたは、pom.xmlが 'project'ではなく' directories'にあることを確信していますか? – blackbuild