I'm trying to publish the resulting jar from a Gradle build. The problem I've come across is that the PublishBuildArtifacts
fails with:
##[error]Publishing build artifacts failed with an error: Not found PathtoPublish: /home/vsts/work/1/s/build/libs/sleuth-kafka-streams-0.0.1-SNAPSHOT.jar'
Here's the whole pipeline definition:
- main
pool:
vmImage: ubuntu-latest
jobs:
- job: build
steps:
- script: echo Hello, world!
displayName: 'Run a one-line script'
- script: |
echo Add other tasks to build, test, and deploy your project.
echo See https://aka.ms/yaml
displayName: 'Run a multi-line script'
- script: pwd
- script: find ./
- task: Gradle@2
inputs:
gradleWrapperFile: 'gradlew'
tasks: 'clean build -x test'
workingDirectory: ''
publishJUnitResults: false
testResultsFiles: '**/TEST-*.xml'
javaHomeOption: 'JDKVersion'
sonarQubeRunAnalysis: false
sqGradlePluginVersionChoice: 'specify'
sonarQubeGradlePluginVersion: '2.6.1'
- script: find ../
- script: find ../../
- script: pwd
- script: echo $(Build.ArtifactStagingDirectory)
- script: echo $(System.DefaultWorkingDirectory)
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: $(System.DefaultWorkingDirectory)/build/libs/sleuth-kafka-streams-0.0.1-SNAPSHOT.jar'
ArtifactName: 'drop'
publishLocation: 'Container'
The jar file is actually there as I can see in the output of the different find
scripts, e.g.:
find ../../
========================== Starting Command Output ===========================
/bin/bash --noprofile --norc /home/vsts/work/_temp/3ff8a757-49a9-4769-b65f-72282d823867.sh
...
../../1/s/build/libs/sleuth-kafka-streams-0.0.1-SNAPSHOT.jar
I also tried using $(Build.ArtifactStagingDirectory)
as the begining of the path, PathtoPublish: $(Build.ArtifactStagingDirectory)/build/libs/sleuth-kafka-streams-0.0.1-SNAPSHOT.jar'
.
In this case the error is:
##[warning]Directory '/home/vsts/work/1/a' is empty. Nothing will be added to build artifact 'drop'
Can you see what's wrong here?