Several of my Maven projects using maven-assembly-plugin should copy two binaries to a folder.
These are two original files that are common to all my projects:
procrun.exe
procrunw.exe
I would like this set of files to be reused. They can come from a dependency, such as a JAR or ZIP file, to subsequently unzip them as part of my build process. That way, if I later decided to update the binaries, I could create a new version of my shared project and just change the dependencies to my shared project. Another reason for this is because I want to use minimization of the number of files associated with building files in individual projects.
Now the tricky part is that I need to rename each file when unpacking the dependencies . For example, for project A, I need files that need to be copied as follows:
bin / projectA_procrun.exe
bin / projectA_procrunw.exe
Partial solution
My partial solution is to have these two files in the src / main / build / bin folder for each of the Maven projects .
This is not ideal, but at least I can reuse the contents of the shared assembly file as described on this page :
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> <id>my_assembly</id> <formats> <format>zip</format> </formats> <files> <file> <source>src/main/build/bin/procrun.exe</source> <outputDirectory>bin</outputDirectory> <destName>${myexecutable.name}.exe</destName> </file> <file> <source>src/main/build/bin/procrunw.exe</source> <outputDirectory>bin</outputDirectory> <destName>${myexecutable.name}w.exe</destName> </file> </files> </assembly>
Unsuccessful attempt
The outputFileNameMapping attribute in Assembly allows you to rename artifacts, but not files within the assembly.
One unsuccessful attempt was to register each file as a separate Maven artifact. That way I could use outputFileNameMapping inside the sections corresponding to each of my artifacts.
The problem I am facing is that Nexus does not like to have "exe" as an artifact.
Question
Any ideas on how I can achieve the expected result, either by improving my partial, or by adopting an alternative approach?