Maven war artifact with car extension
I am trying to use Maven to generate an artifact for deploying on Vignette Portal. The packaging is exactly the same as a war
artifact but the file should have car
extension instead.
Options I've tried and I've not been able to complete.
- Use war plugin and rename the final artifact (keeps adding .war extension)
- Use assembly plugin with zip descriptor (not able to change .zip to .car extension)
- Cre开发者_如何学Cate a new packaging type as described here (can't use war plugin for .car extension)
Which would be the easiest 'Maven' way to generate the .car file? Could you give me some guidance?
Thank you.
I think it's not possible to rename the main deliverable artifact of a project.
Anyway, in the past, what I've done so far was making maven copy the file with a new name and then "attach" it to the deliverables of a build; by configuring two plugins:
- maven-ant-run to copy
maven-build-helper to attach in order to be deployed to my repo along with the main artifact of my project.
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <phase>package</phase> <configuration> <target> <copy file="${project.build.directory}/${project.build.finalName}.war" tofile="${project.build.directory}/${project.build.finalName}.car" /> </target> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin>
And the second:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>attach-instrumented-jar</id>
<phase>verify</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${project.build.directory}/${project.build.finalName}.car</file>
<type>car</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
I hope that can help you. At least until you find a better solution.
精彩评论