I'm using an assembly descriptor of the "dir" format to produce an exploded distributable. Currently this places the files I include in a directory named "target/${project.build.finalName}".
I would ideally like this directory to be named differently. Ideally "target/${project.artifactId}", essentially dropping the version component.
The reason for wanting this change is that I'm going to need to refer to files in that archive in a discrete pipeline step, and having the version in the path presents maintainability issues.
Simplified version of the assembly descriptor provided:
<assembly>
<id>preparation</id>
<formats>
<format>dir</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}/src/main/resources</directory>
<outputDirectory/>
</excludes>
</fileSet>
</fileSets>
</assembly>
Where I currently end up with a root dir like:
target/myArtifactId-1.0.0-SNAPSHOT/assembledResources
and I would like to arrive at
target/myArtifactId/assembledResources
baseDirectory and friends only affect the paths within the root directory, still leaving me with a path which includes a version number, like:
target/myArtifactId-1.0.0-SNAPSHOT/myArtifactId/assembledResources
In your maven maven-assembly-plugin configure the <finalName>
to be ${project.artifactId}
Note:
In the example below, change the location of <descriptor>src/assembly/dist.xml</descriptor>
to your location.
For example:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<descriptors>
<descriptor>src/assembly/dist.xml</descriptor>
</descriptors>
<finalName>${project.artifactId}</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
I'm assuming that you don't want the "preparation" appended to the name so I included <appendAssemblyId>false</appendAssemblyId>