首页 > 解决方案 > Azure DevOps 工件

问题描述

我是 Azure DevOps(托管代理)的新手,我正在尝试使用 Azure Pipelines 使用 Ant 构建我的 Java Web 应用程序

下面是管道文件

trigger:
- azure-pipelines

pool:
  vmImage: 'ubuntu-latest'

steps:
- task: Ant@1
  inputs:
    workingDirectory: ''
    buildFile: 'ant/build.xml'
    javaHomeOption: 'JDKVersion'
    jdkVersionOption: '1.8'
    jdkArchitectureOption: 'x64'
    publishJUnitResults: true
    testResultsFiles: '**/TEST-*.xml'

项目构建成功,但 WAR 文件的路径显示为

建设战争:/home/vsts/work/1/s/war/Project.war

我无法/home/vsts/work/1/s在 Azure DevOps 中找到路径,我尝试在 Artifact 下搜索但未找到,如何访问/home/vsts/work/1/s以便获取我的 WAR 文件?

标签: azureazure-devops

解决方案


您需要使用Publish Artifact任务才能获得构建的结果。

- task: PublishBuildArtifacts@1
  inputs:
    pathtoPublish: '$(Build.ArtifactStagingDirectory)' # or your build results directory 
    artifactName: 'drop' 
    #publishLocation: 'Container' # Options: container, filePath
    #targetPath: # Required when publishLocation == FilePath
    #parallel: false # Optional
    #parallelCount: # Optional
    #fileCopyOptions: #Optional

推荐阅读