0

I am in the process converting existing maven projects to freestyle projects, where the post-build step to deploy to repository are used only with maven project.

what is the equivalent for implementing the below with a freestyle project type. Is there any way to directly use mvn deploy as a postbuild step to push the artifacts at the end of a build to the artifact server (nexus) ?

Now for instance when you run the following example with JJB, you can see job gets updated, but the Deploy Artifacts to maven repository is displayed for a freestyle project type but does not work as expected, since its used only with a maven project type.

- job:
    name: test-freestyle
    project-type: freestyle
    description: 'example for freestyle'
    builders:
        - shell: |
            echo 'Hello world'
            cat /etc/passwd
    publishers:
        - maven-deploy:
            id: example
            url: http://repo.example.com/maven2/
            unique-version: true
            deploy-unstable: false
            release-env-var: TIMER
askb
  • 6,501
  • 30
  • 43

1 Answers1

0

The working solution I found was to use a - maven-target under the builder section as follows:

- job:
    name: test-freestyle
    project-type: freestyle
    description: 'example for freestyle'
    builders:
        - shell: |
            echo 'Hello world'
            cat /etc/passwd
        - maven-target:
            maven-version: '{mvn33}'
            pom: pom.xml'
            goals: 'clean install deploy -DdeployAtEnd=true ...'
            settings: '{mvn-settings}'

Note: Found that the maven deploy plugin has some issue uploading the artifacts when DeployAtEnd option is used, in that case simple use deploy without the option.

askb
  • 6,501
  • 30
  • 43