Maven战争神器与汽车延长

fgl*_*lez 5 vignette maven-2 maven-3 maven-assembly-plugin

我正在尝试使用Maven生成用于在Vignette Portal上部署的工件.包装与war工件完全相同,但文件应该有car扩展名.

我尝试过的选项,但我无法完成.

  • 使用war插件并重命名最终的工件(继续添加.war扩展名)
  • 使用带zip描述符的程序集插件(无法将.zip更改为.car扩展名)
  • 创建一个新的包装类型,描述在这里(不能使用.汽车延长战争的插件)

哪个是最简单的'Maven'生成.car文件的方法?你能给我一些指导吗?

谢谢.

msc*_*ker 7

我认为不可能重命名项目的主要可交付工件.

无论如何,在过去,我到目前为止所做的是让maven使用新名称复制文件,然后将其"附加"到构建的可交付成果; 通过配置两个插件:

  • maven-ant-run要复制
  • 附加的maven-build-helper,以便与我的项目的主要工件一起部署到我的仓库.

    <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>
    
    Run Code Online (Sandbox Code Playgroud)

第二个:

    <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>
Run Code Online (Sandbox Code Playgroud)

我希望能帮助你.至少在找到更好的解决方案之前.