Issue
I have a scala project, which packages (using maven) perfectly fine locally and also the build pipeline on azure devops works fine. Now I would like to somehow retrieve the produced .jar files in the target folder. Therefore I would like to publish the artifacts. But the .jar files can nowhere be found. I have the following azure-pipelines.yaml, which copies/publishes the whole folder to the targetFolder, but there is no target folder, only the source code folder is copied. Now my question, how can one publish/access to published artifacts?
trigger:
- azure_devops_pipeline
pool:
vmImage: ubuntu-latest
stages:
- stage: Package
jobs:
- job: Package
steps:
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
jdkArchitectureOption: 'x64'
publishJUnitResults: false
mavenAuthenticateFeed: true
effectivePomSkip: true
goals: 'package'
options: '-Dmaven.test.skip=true -Pscala-2.12 -Pfat-jar'
#sonarQubeRunAnalysis: false
- stage: PublishArtifacts
jobs:
- job: PublishArtifacts
steps:
- task: CopyFiles@2
inputs:
#SourceFolder: '/home/vsts/work/1/s/target/'
Contents: '**'
TargetFolder: '$(build.artifactstagingdirectory)'
CleanTargetFolder: true
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
Solution
Eeach job is a seprate machine. SO if you compile and produce files on one job they are not available on next job unless you will publish those files as artifact and download them on another artifact. So if you want to have this working please move them (steps from PublishArtifacts job) to your first job.
Answered By - Krzysztof Madej
Answer Checked By - Senaida (JavaFixing Volunteer)