In my Maven project, I am using the maven-assembly-plugin bound to the package phase to create a distribution archive (zip) of the project. When I call mvn clean install to build & install the project, this archive gets installed into my local repository (.m2) as well. How can I exclude it from the installation? Or more generally, how can I exclude certain files/maven products from installation? I tried to relocate the assembly output out of the target directory but that wasn't the solution.
You can set the attach
property of the maven-assembly-plugin to false
, see the docs.
That way the file is generated but not attached to the project, excluding it from operations like install
and deploy
.
That being said, I don't recommend this as it can lead to unexpected behavior down the line.