将工件添加到标准maven部署

时间:2010-07-18 23:44:08

标签: maven-2 deployment

我希望有人能帮助我进行maven部署(通常通过发布插件运行)。

我希望在发布时将除打包的jar之外的文件部署到repo,例如特定的指令文档和生成的SQL文件。

如果我不必为每一个使用deploy:deploy-file,那将是一件好事。最好是我可以将每个文件添加到我的POM文件中的列表中,并在发布时自动为我拾取。

1 个答案:

答案 0 :(得分:11)

使用Maven Assembly Plugin将它们打包成一个将安装/部署的程序集。

或使用attach-artifactbuild-helper plugin目标:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>build-helper-maven-plugin</artifactId>
  <version>1.5</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>