Maven military artifact with car extension

I am trying to use Maven to create an artifact for deployment on the Vignette Portal. The packaging is exactly the same as the artifact war, but the file must have the extension car.

Parameters that I tried and I could not execute.

  • Use a military plugin and rename the final artifact (continues to add the extension .war)
  • Use build plugin with zip descriptor (unable to change .zip to .car extension)
  • Create a new type of packaging as described here (you cannot use the military plug-in for the .car extension)

What would be the easiest Maven way to create a .car file? Could you give me some advice?

Thank.

+5
source share
1 answer

I think it’s impossible to rename the main supplied artifact of the project.

In any case, in the past, what I have done so far is to make maven copy the file with the new name, and then “attach” it to the build results; by configuring two plugins:

  • maven- ant -run to copy
  • maven-build-helper for attaching to be deployed in 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 this can help you. At least until you find the best solution.

+7
source

All Articles