Issue
Small question regarding maven-assembly-plugin please.
I am currently configuring as follow:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>build</id>
<configuration>
<archive>
<manifest>
<mainClass>my.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>${project.artifactId}-mymain</finalName>
<outputDirectory>./</outputDirectory>
</configuration>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
This has nothing special, copied from the official website on how to configure.
Now, we use a CI tool, the CI tool, which we do not control, will run the following steps (we cannot change it)
compile:
maven -DskipTests clean package
test
maven verify
stage
maven -skipTests deploy
It will run the three steps separately, again, nothing I can do about it.
Now, the thing it, it seems with the current maven-assembly-plugin
as configured above, the uber jar is built once each stage, resulting in a total of 3 jars being built.
How to configure the plugin, to avoid being built and rebuilt, hoping to be built only in one specific phase please?
Thank you
Solution
As mentioned by @khmarbaise, this <phase>install</phase>
works. All the credit to him, thank you
Answered By - PatPatPat
Answer Checked By - Clifford M. (JavaFixing Volunteer)