I have a Maven
project Foo, which uses maven-shade-plugin
to package a webstart fat jar, one that includes all its dependencies.
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>foo-fat</finalName>
...
Another project is Bar, which is a web application that, among other things, distributes the Foo webstart. I need to copy foo-fat.jar into the Bar interim pre-package directory and for that, I am using maven-dependency-plugin
:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>prepare-package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>my-group</groupId>
<artifactId>foo</artifactId>
<outputDirectory>...</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
The problem is, this doesn't fetch foo-fat.jar but has Foo generate a simple jar foo.jar that doesn't include dependencies. It may be relevant to note that the only artifact Foo has in the local repo is the slim jar and I was unable to get the fat jar there by running any Maven lifecycle. Running mvn clean package
in Foo directly does package a fat jar but not when called from Bar's pom.xml as is shown above.
How do I get maven-dependency-plugin to use a different project artifact, such as the fat jar made by the shade plugin?
lazyeconomic typers, aren't we. ;) – Gerold Broser Jul 12 '17 at 22:00