java 如何在Maven中将文件部署到Artifactory?

emeijp43  于 2023-05-27  发布在  Java
关注(0)|答案(1)|浏览(112)

我当前的pom配置为将jar部署到我的artifactory。此外,还有一个运行jar的bash脚本,我也将其保存在我的项目中。我也想把这个脚本(与jar分开)部署到我的artifactory中,使用相同的版本。
可能吗?如果是的话,我应该在POM中添加什么来实现这一点呢?

5f0d552i

5f0d552i1#

您可以从Apache Maven Deploy Plugin使用deploy:deploy-file目标

<plugins>
  <!-- other plugins ...-->
  <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-deploy-plugin</artifactId>
      <version>3.0.0-M1</version>

    <executions>
      <execution>
        <goals>
          <goal>deploy-file</goal>
        </goals>

        <phase>deploy</phase> <!-- change this if you need another phase -->

        <configuration>
          <groupId>${project.groupId}</groupId><!-- same groupId as the project, you can choose another one-->
          <artifactId>${project.groupId}-script</artifactId><!-- whatever you want -->
          <version>${project.version}</version><!-- same version as the project, but you can choose another one -->

          <file><!-- path to your script --></file>
          <pomFile> <!-- path to the pom file of the script --></pomFile>
          <generatePom><!-- but maybe you don't want a pom file for the script, so set this to false--></generatePom>
          <repositoryId><!-- the one configured in your settings.xml and distributionManagement  --></repositoryId>
          <url><!-- the one configured in your settings.xml and distributionManagement --></url>
        </configuration>
      </execution>
    </executions>
  </plugin>
</plugins>

相关问题