【问题标题】:How do I deploy files to Artifactory in Maven?如何在 Maven 中将文件部署到 Artifactory?
【发布时间】:2022-01-06 15:52:24
【问题描述】:

我当前的 pom 配置为将 jar 部署到我的工件。 此外,还有一个运行 jar 的 bash 脚本,我也将它保存在我的项目中。 我也想将此脚本(与 jar 分开)部署到同一版本下的我的工件中。

有可能吗?如果是这样,我应该在 pom 中添加什么才能做到这一点?

【问题讨论】:

    标签: java maven artifactory maven-plugin artifacts


    【解决方案1】:

    您可以使用来自Apache Maven Deploy Plugindeploy: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}-script</groupId><!-- whatever you want -->
              <artifactId>${project.groupId}</artifactId><!-- same groupId as the project, you can choose another one--> 
              <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>
    

    【讨论】:

    • 非常感谢!!!
    猜你喜欢
    • 2015-10-31
    • 1970-01-01
    • 2018-06-21
    • 1970-01-01
    • 1970-01-01
    • 2015-11-22
    • 1970-01-01
    • 2017-06-13
    • 2017-11-05
    相关资源
    最近更新 更多