【问题标题】:Maven war artifact with car extension带有汽车扩展的 Maven 战争神器
【发布时间】:2011-05-16 09:51:49
【问题描述】:

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

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

  • 使用war插件并重命名最终工件(不断添加.war扩展名)
  • 使用带有 zip 描述符的程序集插件(无法将 .zip 更改为 .car 扩展名)
  • 按照here 的描述创建一个新的打包类型(不能为 .car 扩展名使用 war 插件)

生成 .car 文件的最简单的“Maven”方法是什么?你能给我一些指导吗?

谢谢。

【问题讨论】:

    标签: maven-2 maven-3 maven-assembly-plugin vignette


    【解决方案1】:

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

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

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

      <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>
      

    第二个:

        <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>
    

    希望对你有帮助。至少在你找到更好的解决方案之前。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-03-29
    • 1970-01-01
    • 2013-03-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多