'Upload .zip file to Nexus using azure build

Someone please advise me how to convert the built .jar file to .zip file then push it to nexus repo.

for building the .jar file i am using azure build pipeline in that i have added the convert zip file stage but its giving below error.

  - job: MavenPushToNexus
    dependsOn:
    - Build
    steps:
    - task: ArchiveFiles@2
      inputs:
        archiveType: 'zip'
        archiveFile: '$(Build.SourcesDirectory)/service/target/ohm-ea-onprem-adaptor-service-1.0.0.jar'
        replaceExistingArchive: true
    - task: MavenAuthenticate@0
      displayName: Nexus MaerskDevNet Authentication
      inputs:
        mavenServiceConnections: $(NexusConnection)
    - task: Maven@3
      inputs:
        mavenPomFile: 'service/pom.xml'
        mavenOptions: '-Xmx3072m'
        javaHomeOption: 'JDKVersion'
        jdkVersionOption: '1.11'
        jdkArchitectureOption: 'x64'
        publishJUnitResults: true
        testResultsFiles: '**/surefire-reports/TEST-*.xml'
        goals: 'deploy'

Getting below error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-
plugin:2.8.2:deploy-file (deploy-file) on project ohm-ea-onprem-
adaptor-service: /home/vsts/work/1/s/service/target/ohm-ea-onprem-
adaptor-service-1.0.0.jar.zip not found. -> [Help 1]

Let me know how to fix this issue.

Thanks,



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source