Reputation: 97
I have an Azure pipeline that is supposed to be building my java code with maven. The YAML looks like this:
steps:
- task: Maven@3
inputs:
mavenPomFile: '$(system.defaultWorkingDirectory)/<project-name>/pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
jdkArchitectureOption: 'x64'
publishJUnitResults: false
testResultsFiles: '**/TEST-*.xml'
goals: 'package'
#allowBrokenSymlinks:
# Copy jar file from a source folder to a target folder
- task: CopyFiles@1
inputs:
sourceFolder: '$(system.defaultWorkingDirectory)/<project-name>/target'
contents: 'filename.jar'
targetFolder: '$(Build.ArtifactStagingDirectory)'
cleanTargetFolder: false # Optional
overWrite: true # Optional
I was expecting there to be a jar file in the /target but nothing shows up there. Then, since there is no jar file created, the copy to Artifactory doesn't work either. The pipeline runs without error. Azure docs are clear as mud.
I'm new to Azure and Artifactory so please keep it simple if you can help!
Upvotes: 1
Views: 2697
Reputation: 65
Have you tried using Wild Card for fetching the jar?
Example:
- task: CopyFiles@1
inputs:
sourceFolder: '$(system.defaultWorkingDirectory)/<project-name>/target'
contents: *.jar
targetFolder: '$(Build.ArtifactStagingDirectory)'
cleanTargetFolder: false # Optional
overWrite: true # Optional
Upvotes: 0
Reputation: 6033
The easiest and most recommended way is to use the Artifactory Azure DevOps extension. The extension uses the JFrog CLI to build and upload your Maven JARs to Artifactory.
After downloading and installation of the extension, you can configure your pipeline in 2 steps
install
goal instead of package
.For more information see:
Upvotes: 1