Skip to content

Latest commit

 

History

History
60 lines (48 loc) · 3.23 KB

README.md

File metadata and controls

60 lines (48 loc) · 3.23 KB

Maven Artifactory Plugin

Overview

This example is using the Maven Artifactory Plugin for artifacts abd build-info deployment to Artifactory.

Running this example

To run this example, please do the following:

  • Edit the pom.xml file and set the value of the contextUrl with your Artifactory URL, as well as the other Artifactory properties. For more configuration information see the Maven Artifactory Plugin documentation.
  • CD to the project directory and run the following command (replace admin and password with your Artifactory credentials):
> mvn deploy -Dusername=admin -Dpassword=password

This would deploy the produced artifacts to the configured Artifactory server:

 [INFO] Artifactory Build Info Recorder: Saving Build Info to 'C:\dev\project-examples\artifactory-maven-plugin-example\target\build-info.json'
 [INFO] Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/multi3/2.17-SNAPSHOT/multi3-2.17-SNAPSHOT.war
 [INFO] Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/multi3/2.17-SNAPSHOT/multi3-2.17-SNAPSHOT.pom
 [INFO] Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/multi/2.17-SNAPSHOT/multi-2.17-SNAPSHOT.pom
 [INFO] Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/multi1/2.17-SNAPSHOT/multi1-2.17-SNAPSHOT.jar
 [INFO] Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/multi1/2.17-SNAPSHOT/multi1-2.17-SNAPSHOT.pom
 [INFO] Artifactory Build Info Recorder: Skipping the deployment of 'org/jfrog/test/multi1/2.17-SNAPSHOT/multi1-2.17-SNAPSHOT-tests.jar' due to the defined include-exclude patterns.
 [INFO] Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/multi1/2.17-SNAPSHOT/multi1-2.17-SNAPSHOT-sources.jar
 [INFO] Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/multi2/2.17-SNAPSHOT/multi2-2.17-SNAPSHOT.jar
 [INFO] Deploying artifact: http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/test/multi2/2.17-SNAPSHOT/multi2-2.17-SNAPSHOT.pom
 [INFO] Artifactory Build Info Recorder: Deploying build info ...
 [INFO] Deploying build descriptor to: http://localhost:8081/artifactory/api/build
 [INFO] Build successfully deployed. Browse it in Artifactory under http://localhost:8081/artifactory/webapp/builds/plugin-demo/1

Pipeline script

node {
    stage 'Clone'
     git url: 'https://github.com/TamirHadad/power-unit.git'
     stage 'Set mvnHome'
     withEnv(["PATH+MAVEN=${tool 'M3'}/bin"]) {
         stage 'clean install'
         sh "mvn clean install -Dmaven.test.skip=true"
         stage 'test'
         sh "mvn test"
         stage 'deploy'
         sh "mvn deploy -Dmaven.test.skip=true"
    }
}

Sending parameters to the pom file

You can send parameters as system properties, and then use them inside the pom file, the same way the username and password properties are sent as shown above.

Plugin documentation

The full plugin documentation is available here.