Due to need for heavy customization I did developed my own Groovy plugin, which creates ZIP archive, which is 100% ready for deployment (like Maven assembly plugin does). Still, if I run
mvn clean install ...
command it creates an assembly (single ZIP file), puts it to ${project.build.directory} (.../target) and that's it.
How do I tell Maven, that it's now part of deployment and I would like to deploy this ZIP file?
You have two options:
Use buildhelper:attach-artifact:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>some file</file>
<type>extension of your file </type>
<classifier>optional</classifier>
</artifact>
...
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
Alternatively (and better), you could include the necessary code in your own plugin:
@Component
protected MavenProject project;
@Component
protected MavenProjectHelper projectHelper;
...
projectHelper.attachArtifact(project, "jar", resource.getClassifier(), targetArchive);