adding artifacts to standard maven deploy

故事扮演 提交于 2020-01-01 05:49:06

问题


I was hoping someone could help me with maven deployments (typically run through the release plugin).

I want to deploy files other than just the packaged jar to the repo upon release, such as specific instruction documents and generated SQL files.

It would be good if i did not have to use deploy:deploy-file for each one. it would be best if I could just add each file to a list within my POM file and it would be picked up automatically for me upon release.


回答1:


Either use the Maven Assembly Plugin to package them into an assembly that will get installed/deployed.

Or use the attach-artifact goal of the build-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>


来源:https://stackoverflow.com/questions/3277697/adding-artifacts-to-standard-maven-deploy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!