I am trying to achieve the same objective to the question posted here, namely to assemble a war dependency into a deployable zip, with both the war and some of its unpacked *.yml files in the final zip. I have the war file correctly assembled into the zip, but I can't get the maven-dependency-plugin to unpack the *.yml files out of the war for re-packing.
For clarity, this is what I have:
- Project 1
- Name: myapp-war
- Packaging: war
- Project 2
- Name: myapp-deploy
- Packaging: pom
- Dependency: myapp-war:war
- Desired output: myapp.zip which includes:
- bin/myapp.war
- conf/application-*.yml
Here's what my plugin declaration looks like:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>unpack</id>
<phase>prepare-package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>myapp</groupId>
<artifactId>myapp-war</artifactId>
<type>war</type>
<outputDirectory>${project.build.directory}/unpack</outputDirectory>
<includes>**/*.yml</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
I've also tried a variant where I declared the <outputDirectory>
and <includes>
just underneath the <configuration>
, which is permissible per the unpack mojo docs.
In either case, I get an empty myapp-deploy/target/unpack folder, along with [INFO] and [DEBUG] messages in the maven output stating:
[INFO] Configured Artifact: myapp:myapp-war:?:war
[INFO] Unpacking /build/myapp-war/target/myapp-war-0.0.1-SNAPSHOT.war to /build/myapp-deploy/target/unpack with includes "**/*.yml" and excludes ""
[DEBUG] Found unArchiver by type: org.codehaus.plexus.archiver.zip.ZipUnArchiver$__sisu2@692a65b1
[DEBUG] Expanding: /build/myapp-war/target/myapp-war-0.0.1-SNAPSHOT.war into /build/myapp-deploy/target/unpack
[DEBUG] expand complete
It appears that maven has understood my instructions, but doesn't seem to be unpacking as it claims to. Any idea what I'm doing wrong?