Home > front end >  How do I deploy files to Artifactory in Maven?
How do I deploy files to Artifactory in Maven?

Time:01-09

My current pom is configured to deploy a jar to my artifactory. In addition, there is a bash script that runs the jar and I keep it in my project as well. I would like to deploy this script as well (separately from the jar) to my artifactory under the same version.

is it possible? and if so what should I add to the pom in order to do this?

CodePudding user response:

You can use deploy:deploy-file goal from Apache Maven Deploy Plugin

<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>
  •  Tags:  
  • Related