Maven@2 - Maven v2 任务

使用此任务通过 Apache Maven 生成、测试和部署。

语法

# Maven v2
# Build, test, and deploy with Apache Maven.
- task: Maven@2
  inputs:
    mavenPOMFile: 'pom.xml' # string. Required. Maven POM file. Default: pom.xml.
    #goals: 'package' # string. Goal(s). Default: package.
    #options: # string. Options. 
  # JUnit Test Results
    #publishJUnitResults: true # boolean. Publish to Azure Pipelines. Default: true.
    testResultsFiles: '**/TEST-*.xml' # string. Required when publishJUnitResults = true. Test results files. Default: **/TEST-*.xml.
    #testRunTitle: # string. Optional. Use when publishJUnitResults = true. Test run title. 
    #allowBrokenSymlinks: true # boolean. Alias: allowBrokenSymbolicLinks. Optional. Use when publishJUnitResults = true. Allow broken symbolic links. Default: true.
  # Code Coverage
    #codeCoverageToolOption: 'None' # 'None' | 'Cobertura' | 'JaCoCo'. Alias: codeCoverageTool. Code coverage tool. Default: None.
    #codeCoverageClassFilter: # string. Alias: classFilter. Optional. Use when codeCoverageTool != None. Class inclusion/exclusion filters. 
    #codeCoverageClassFilesDirectories: # string. Alias: classFilesDirectories. Optional. Use when codeCoverageTool = JaCoCo. Class files directories. 
    #codeCoverageSourceDirectories: # string. Alias: srcDirectories. Optional. Use when codeCoverageTool = JaCoCo. Source files directories. 
    #codeCoverageFailIfEmpty: false # boolean. Alias: failIfCoverageEmpty. Optional. Use when codeCoverageTool != None. Fail when code coverage results are missing. Default: false.
    #codeCoverageRestoreOriginalPomXml: false # boolean. Alias: restoreOriginalPomXml. Optional. Use when codeCoverageTool != None. Restore original pom.xml after task execution. Default: false.
  # Advanced
    javaHomeOption: 'JDKVersion' # 'JDKVersion' | 'Path'. Alias: javaHomeSelection. Required. Set JAVA_HOME by. Default: JDKVersion.
    #jdkVersionOption: 'default' # 'default' | '1.17' | '1.11' | '1.10' | '1.9' | '1.8' | '1.7' | '1.6'. Alias: jdkVersion. Optional. Use when javaHomeSelection = JDKVersion. JDK version. Default: default.
    #jdkDirectory: # string. Alias: jdkUserInputPath. Required when javaHomeSelection = Path. JDK path. 
    #jdkArchitectureOption: 'x64' # 'x86' | 'x64'. Alias: jdkArchitecture. Optional. Use when jdkVersion != default. JDK architecture. Default: x64.
    mavenVersionOption: 'Default' # 'Default' | 'Path'. Alias: mavenVersionSelection. Required. Maven version. Default: Default.
    #mavenDirectory: # string. Alias: mavenPath. Required when mavenVersionSelection = Path. Maven path. 
    #mavenSetM2Home: false # boolean. Optional. Use when mavenVersionSelection = Path. Set M2_HOME variable. Default: false.
    #mavenOptions: '-Xmx1024m' # string. Alias: mavenOpts. Set MAVEN_OPTS to. Default: -Xmx1024m.
    #mavenAuthenticateFeed: true # boolean. Alias: mavenFeedAuthenticate. Authenticate with Artifacts feeds. Default: true.
  # Code Analysis
    #sonarQubeRunAnalysis: false # boolean. Alias: sqAnalysisEnabled. Run SonarQube or SonarCloud analysis. Default: false.
    #isJacocoCoverageReportXML: false # boolean. Optional. Use when sqAnalysisEnabled = true && codeCoverageTool = JaCoCo. Use XML Jacoco reports for SonarQube analysis. Default: false.
    #sqMavenPluginVersionChoice: 'latest' # 'latest' | 'pom'. Required when sqAnalysisEnabled = true. SonarQube scanner for Maven version. Default: latest.
    #checkStyleRunAnalysis: false # boolean. Alias: checkstyleAnalysisEnabled. Run Checkstyle. Default: false.
    #pmdRunAnalysis: false # boolean. Alias: pmdAnalysisEnabled. Run PMD. Default: false.
    #findBugsRunAnalysis: false # boolean. Alias: findbugsAnalysisEnabled. Run FindBugs. Default: false.
# Maven v2
# Build, test, and deploy with Apache Maven.
- task: Maven@2
  inputs:
    mavenPOMFile: 'pom.xml' # string. Required. Maven POM file. Default: pom.xml.
    #goals: 'package' # string. Goal(s). Default: package.
    #options: # string. Options. 
  # JUnit Test Results
    #publishJUnitResults: true # boolean. Publish to Azure Pipelines. Default: true.
    testResultsFiles: '**/TEST-*.xml' # string. Required when publishJUnitResults = true. Test results files. Default: **/TEST-*.xml.
    #testRunTitle: # string. Optional. Use when publishJUnitResults = true. Test run title. 
    #allowBrokenSymlinks: true # boolean. Alias: allowBrokenSymbolicLinks. Optional. Use when publishJUnitResults = true. Allow broken symbolic links. Default: true.
  # Code Coverage
    #codeCoverageToolOption: 'None' # 'None' | 'Cobertura' | 'JaCoCo'. Alias: codeCoverageTool. Code coverage tool. Default: None.
    #codeCoverageClassFilter: # string. Alias: classFilter. Optional. Use when codeCoverageTool != None. Class inclusion/exclusion filters. 
    #codeCoverageClassFilesDirectories: # string. Alias: classFilesDirectories. Optional. Use when codeCoverageTool = JaCoCo. Class files directories. 
    #codeCoverageSourceDirectories: # string. Alias: srcDirectories. Optional. Use when codeCoverageTool = JaCoCo. Source files directories. 
    #codeCoverageFailIfEmpty: false # boolean. Alias: failIfCoverageEmpty. Optional. Use when codeCoverageTool != None. Fail when code coverage results are missing. Default: false.
    #codeCoverageRestoreOriginalPomXml: false # boolean. Alias: restoreOriginalPomXml. Optional. Use when codeCoverageTool != None. Restore original pom.xml after task execution. Default: false.
  # Advanced
    javaHomeOption: 'JDKVersion' # 'JDKVersion' | 'Path'. Alias: javaHomeSelection. Required. Set JAVA_HOME by. Default: JDKVersion.
    #jdkVersionOption: 'default' # 'default' | '1.17' | '1.11' | '1.10' | '1.9' | '1.8' | '1.7' | '1.6'. Alias: jdkVersion. Optional. Use when javaHomeSelection = JDKVersion. JDK version. Default: default.
    #jdkDirectory: # string. Alias: jdkUserInputPath. Required when javaHomeSelection = Path. JDK path. 
    #jdkArchitectureOption: 'x64' # 'x86' | 'x64'. Alias: jdkArchitecture. Optional. Use when jdkVersion != default. JDK architecture. Default: x64.
    mavenVersionOption: 'Default' # 'Default' | 'Path'. Alias: mavenVersionSelection. Required. Maven version. Default: Default.
    #mavenDirectory: # string. Alias: mavenPath. Required when mavenVersionSelection = Path. Maven path. 
    #mavenSetM2Home: false # boolean. Optional. Use when mavenVersionSelection = Path. Set M2_HOME variable. Default: false.
    #mavenOptions: '-Xmx1024m' # string. Alias: mavenOpts. Set MAVEN_OPTS to. Default: -Xmx1024m.
    #mavenAuthenticateFeed: true # boolean. Alias: mavenFeedAuthenticate. Authenticate built-in Maven feeds. Default: true.
  # Code Analysis
    #sonarQubeRunAnalysis: false # boolean. Alias: sqAnalysisEnabled. Run SonarQube or SonarCloud analysis. Default: false.
    #isJacocoCoverageReportXML: false # boolean. Optional. Use when sqAnalysisEnabled = true && codeCoverageTool = JaCoCo. Use XML Jacoco reports for SonarQube analysis. Default: false.
    #sqMavenPluginVersionChoice: 'latest' # 'latest' | 'pom'. Required when sqAnalysisEnabled = true. SonarQube scanner for Maven version. Default: latest.
    #checkStyleRunAnalysis: false # boolean. Alias: checkstyleAnalysisEnabled. Run Checkstyle. Default: false.
    #pmdRunAnalysis: false # boolean. Alias: pmdAnalysisEnabled. Run PMD. Default: false.
    #findBugsRunAnalysis: false # boolean. Alias: findbugsAnalysisEnabled. Run FindBugs. Default: false.
# Maven v2
# Build, test, and deploy with Apache Maven.
- task: Maven@2
  inputs:
    mavenPOMFile: 'pom.xml' # string. Required. Maven POM file. Default: pom.xml.
    #goals: 'package' # string. Goal(s). Default: package.
    #options: # string. Options. 
  # JUnit Test Results
    #publishJUnitResults: true # boolean. Publish to Azure Pipelines. Default: true.
    testResultsFiles: '**/TEST-*.xml' # string. Required when publishJUnitResults = true. Test results files. Default: **/TEST-*.xml.
    #testRunTitle: # string. Optional. Use when publishJUnitResults = true. Test run title. 
  # Code Coverage
    #codeCoverageToolOption: 'None' # 'None' | 'Cobertura' | 'JaCoCo'. Alias: codeCoverageTool. Code coverage tool. Default: None.
    #codeCoverageClassFilter: # string. Alias: classFilter. Optional. Use when codeCoverageTool != None. Class inclusion/exclusion filters. 
    #codeCoverageClassFilesDirectories: # string. Alias: classFilesDirectories. Optional. Use when codeCoverageTool = JaCoCo. Class files directories. 
    #codeCoverageSourceDirectories: # string. Alias: srcDirectories. Optional. Use when codeCoverageTool = JaCoCo. Source files directories. 
    #codeCoverageFailIfEmpty: false # boolean. Alias: failIfCoverageEmpty. Optional. Use when codeCoverageTool != None. Fail when code coverage results are missing. Default: false.
    #codeCoverageRestoreOriginalPomXml: false # boolean. Alias: restoreOriginalPomXml. Optional. Use when codeCoverageTool != None. Restore original pom.xml after task execution. Default: false.
  # Advanced
    javaHomeOption: 'JDKVersion' # 'JDKVersion' | 'Path'. Alias: javaHomeSelection. Required. Set JAVA_HOME by. Default: JDKVersion.
    #jdkVersionOption: 'default' # 'default' | '1.11' | '1.10' | '1.9' | '1.8' | '1.7' | '1.6'. Alias: jdkVersion. Optional. Use when javaHomeSelection = JDKVersion. JDK version. Default: default.
    #jdkDirectory: # string. Alias: jdkUserInputPath. Required when javaHomeSelection = Path. JDK path. 
    #jdkArchitectureOption: 'x64' # 'x86' | 'x64'. Alias: jdkArchitecture. Optional. Use when jdkVersion != default. JDK architecture. Default: x64.
    mavenVersionOption: 'Default' # 'Default' | 'Path'. Alias: mavenVersionSelection. Required. Maven version. Default: Default.
    #mavenDirectory: # string. Alias: mavenPath. Required when mavenVersionSelection = Path. Maven path. 
    #mavenSetM2Home: false # boolean. Optional. Use when mavenVersionSelection = Path. Set M2_HOME variable. Default: false.
    #mavenOptions: '-Xmx1024m' # string. Alias: mavenOpts. Set MAVEN_OPTS to. Default: -Xmx1024m.
    #mavenAuthenticateFeed: true # boolean. Alias: mavenFeedAuthenticate. Authenticate built-in Maven feeds. Default: true.
  # Code Analysis
    #sonarQubeRunAnalysis: false # boolean. Alias: sqAnalysisEnabled. Run SonarQube or SonarCloud analysis. Default: false.
    #isJacocoCoverageReportXML: false # boolean. Optional. Use when sqAnalysisEnabled = true && codeCoverageTool = JaCoCo. Use XML Jacoco reports for SonarQube analysis. Default: false.
    #sqMavenPluginVersionChoice: 'latest' # 'latest' | 'pom'. Required when sqAnalysisEnabled = true. SonarQube scanner for Maven version. Default: latest.
    #checkStyleRunAnalysis: false # boolean. Alias: checkstyleAnalysisEnabled. Run Checkstyle. Default: false.
    #pmdRunAnalysis: false # boolean. Alias: pmdAnalysisEnabled. Run PMD. Default: false.
    #findBugsRunAnalysis: false # boolean. Alias: findbugsAnalysisEnabled. Run FindBugs. Default: false.
# Maven v2
# Build, test, and deploy with Apache Maven.
- task: Maven@2
  inputs:
    mavenPOMFile: 'pom.xml' # string. Required. Maven POM file. Default: pom.xml.
    #goals: 'package' # string. Goal(s). Default: package.
    #options: # string. Options. 
  # JUnit Test Results
    #publishJUnitResults: true # boolean. Publish to Azure Pipelines. Default: true.
    testResultsFiles: '**/TEST-*.xml' # string. Required when publishJUnitResults = true. Test results files. Default: **/TEST-*.xml.
    #testRunTitle: # string. Optional. Use when publishJUnitResults = true. Test run title. 
  # Code Coverage
    #codeCoverageToolOption: 'None' # 'None' | 'Cobertura' | 'JaCoCo'. Alias: codeCoverageTool. Code coverage tool. Default: None.
    #codeCoverageClassFilter: # string. Alias: classFilter. Optional. Use when codeCoverageTool != None. Class inclusion/exclusion filters. 
    #codeCoverageClassFilesDirectories: # string. Alias: classFilesDirectories. Optional. Use when codeCoverageTool = JaCoCo. Class files directories. 
    #codeCoverageSourceDirectories: # string. Alias: srcDirectories. Optional. Use when codeCoverageTool = JaCoCo. Source files directories. 
    #codeCoverageFailIfEmpty: false # boolean. Alias: failIfCoverageEmpty. Optional. Use when codeCoverageTool != None. Fail when code coverage results are missing. Default: false.
  # Advanced
    javaHomeOption: 'JDKVersion' # 'JDKVersion' | 'Path'. Alias: javaHomeSelection. Required. Set JAVA_HOME by. Default: JDKVersion.
    #jdkVersionOption: 'default' # 'default' | '1.11' | '1.10' | '1.9' | '1.8' | '1.7' | '1.6'. Alias: jdkVersion. Optional. Use when javaHomeSelection = JDKVersion. JDK version. Default: default.
    #jdkDirectory: # string. Alias: jdkUserInputPath. Required when javaHomeSelection = Path. JDK path. 
    #jdkArchitectureOption: 'x64' # 'x86' | 'x64'. Alias: jdkArchitecture. Optional. Use when jdkVersion != default. JDK architecture. Default: x64.
    mavenVersionOption: 'Default' # 'Default' | 'Path'. Alias: mavenVersionSelection. Required. Maven version. Default: Default.
    #mavenDirectory: # string. Alias: mavenPath. Required when mavenVersionSelection = Path. Maven path. 
    #mavenSetM2Home: false # boolean. Optional. Use when mavenVersionSelection = Path. Set M2_HOME variable. Default: false.
    #mavenOptions: '-Xmx1024m' # string. Alias: mavenOpts. Set MAVEN_OPTS to. Default: -Xmx1024m.
    #mavenAuthenticateFeed: true # boolean. Alias: mavenFeedAuthenticate. Authenticate built-in Maven feeds. Default: true.
  # Code Analysis
    #sonarQubeRunAnalysis: false # boolean. Alias: sqAnalysisEnabled. Run SonarQube or SonarCloud analysis. Default: false.
    #sqMavenPluginVersionChoice: 'latest' # 'latest' | 'pom'. Required when sqAnalysisEnabled = true. SonarQube scanner for Maven version. Default: latest.
    #checkStyleRunAnalysis: false # boolean. Alias: checkstyleAnalysisEnabled. Run Checkstyle. Default: false.
    #pmdRunAnalysis: false # boolean. Alias: pmdAnalysisEnabled. Run PMD. Default: false.
    #findBugsRunAnalysis: false # boolean. Alias: findbugsAnalysisEnabled. Run FindBugs. Default: false.
# Maven v2
# Build with Apache Maven.
- task: Maven@2
  inputs:
    mavenPOMFile: 'pom.xml' # string. Required. Maven POM file. Default: pom.xml.
    #goals: 'package' # string. Goal(s). Default: package.
    #options: # string. Options. 
  # JUnit Test Results
    #publishJUnitResults: true # boolean. Publish to Azure Pipelines/TFS. Default: true.
    testResultsFiles: '**/TEST-*.xml' # string. Required when publishJUnitResults = true. Test results files. Default: **/TEST-*.xml.
    #testRunTitle: # string. Optional. Use when publishJUnitResults = true. Test run title. 
  # Code Coverage
    #codeCoverageToolOption: 'None' # 'None' | 'Cobertura' | 'JaCoCo'. Alias: codeCoverageTool. Code coverage tool. Default: None.
    #codeCoverageClassFilter: # string. Alias: classFilter. Optional. Use when codeCoverageTool != None. Class inclusion/exclusion filters. 
    #codeCoverageClassFilesDirectories: # string. Alias: classFilesDirectories. Optional. Use when codeCoverageTool = JaCoCo. Class files directories. 
    #codeCoverageSourceDirectories: # string. Alias: srcDirectories. Optional. Use when codeCoverageTool = JaCoCo. Source files directories. 
    #codeCoverageFailIfEmpty: false # boolean. Alias: failIfCoverageEmpty. Optional. Use when codeCoverageTool != None. Fail when code coverage results are missing. Default: false.
  # Advanced
    javaHomeOption: 'JDKVersion' # 'JDKVersion' | 'Path'. Alias: javaHomeSelection. Required. Set JAVA_HOME by. Default: JDKVersion.
    #jdkVersionOption: 'default' # 'default' | '1.11' | '1.10' | '1.9' | '1.8' | '1.7' | '1.6'. Alias: jdkVersion. Optional. Use when javaHomeSelection = JDKVersion. JDK version. Default: default.
    #jdkDirectory: # string. Alias: jdkUserInputPath. Required when javaHomeSelection = Path. JDK path. 
    #jdkArchitectureOption: 'x64' # 'x86' | 'x64'. Alias: jdkArchitecture. Optional. Use when jdkVersion != default. JDK architecture. Default: x64.
    mavenVersionOption: 'Default' # 'Default' | 'Path'. Alias: mavenVersionSelection. Required. Maven version. Default: Default.
    #mavenDirectory: # string. Alias: mavenPath. Required when mavenVersionSelection = Path. Maven path. 
    #mavenSetM2Home: false # boolean. Optional. Use when mavenVersionSelection = Path. Set M2_HOME variable. Default: false.
    #mavenOptions: '-Xmx1024m' # string. Alias: mavenOpts. Set MAVEN_OPTS to. Default: -Xmx1024m.
    #mavenAuthenticateFeed: true # boolean. Alias: mavenFeedAuthenticate. Authenticate built-in Maven feeds. Default: true.
  # Code Analysis
    #sonarQubeRunAnalysis: false # boolean. Alias: sqAnalysisEnabled. Run SonarQube or SonarCloud analysis. Default: false.
    #sqMavenPluginVersionChoice: 'latest' # 'latest' | 'pom'. Required when sqAnalysisEnabled = true. SonarQube scanner for Maven version. Default: latest.
    #checkStyleRunAnalysis: false # boolean. Alias: checkstyleAnalysisEnabled. Run Checkstyle. Default: false.
    #pmdRunAnalysis: false # boolean. Alias: pmdAnalysisEnabled. Run PMD. Default: false.
    #findBugsRunAnalysis: false # boolean. Alias: findbugsAnalysisEnabled. Run FindBugs. Default: false.

输入

mavenPOMFile - Maven POM 文件
string. 必需。 默认值:pom.xml

指定从存储库根目录到 Maven POM 文件的相对路径。


goals - 目标 ()
string. 默认值:package


options - 选项
string.


publishJUnitResults - 发布到 Azure Pipelines
boolean. 默认值:true

指定将 Maven 生成生成的 JUnit 测试结果发布到 Azure Pipelines 的选项。 每个测试结果文件匹配 Test Results Files 都将发布为 Azure Pipelines 中的测试运行。


publishJUnitResults - 发布到 Azure Pipelines/TFS
boolean. 默认值:true

指定将 Maven 生成生成的 JUnit 测试结果发布到 Azure Pipelines/TFS 的选项。 每个测试结果文件匹配 Test Results Files 都将发布为 Azure Pipelines/TFS 中的测试运行。


testResultsFiles - 测试结果文件
string. 当 publishJUnitResults = true 时,需要此选项。 默认值:**/TEST-*.xml

指定要发布的测试结果文件的路径和模式。 可以使用通配符。 有关 文件匹配模式的详细信息
例如, **/TEST-*.xml 对于名称以 TEST-开头的所有 XML 文件。
如果未指定根路径,则会在默认工作目录下匹配文件,其值在变量 $(System.DefaultWorkingDirectory)中可用。 例如, 的值**/TEST-*.xml实际上会导致 匹配的文件。$(System.DefaultWorkingDirectory)/**/TEST-*.xml


testRunTitle - 测试运行标题
string. 可选。 在 时 publishJUnitResults = true使用 。

指定测试运行的名称。


allowBrokenSymlinks - 允许断开的符号链接
输入别名: allowBrokenSymbolicLinksboolean. 可选。 在 时 publishJUnitResults = true使用 。 默认值:true

false设置为 时,当任务在发布测试结果时发现符号链接断开时生成失败。


codeCoverageToolOption - 代码覆盖率工具
输入别名: codeCoverageToolstring. 允许的值:NoneCoberturaJaCoCo。 默认值:None

指定代码覆盖率工具。


codeCoverageClassFilter - 类包含/排除筛选器
输入别名: classFilterstring. 可选。 在 时 codeCoverageTool != None使用 。

指定一个逗号分隔的筛选器列表,以包括或排除从收集代码覆盖率的类。 例如 +:com.*,+:org.*,-:my.app*.*


codeCoverageClassFilesDirectories - 类文件目录
输入别名: classFilesDirectoriesstring. 可选。 在 时 codeCoverageTool = JaCoCo使用 。

此字段是多模块项目所必需的。
指定从 Maven POM 文件到包含类文件和存档文件的目录 (JAR、WAR 等 ) 的相对路径列表。 将报告这些目录中类文件的代码覆盖率。 例如 target/classes,target/testClasses


codeCoverageSourceDirectories - 源文件目录
输入别名: srcDirectoriesstring. 可选。 在 时 codeCoverageTool = JaCoCo使用 。

此字段是多模块项目所必需的。
指定从 Maven POM 文件到源代码目录的相对路径的逗号分隔列表。 代码覆盖率报告使用这些报告来突出显示源代码。 例如 src/java,src/Test


codeCoverageFailIfEmpty - 缺少代码覆盖率结果时失败
输入别名: failIfCoverageEmptyboolean. 可选。 在 时 codeCoverageTool != None使用 。 默认值:false

如果代码覆盖率未生成任何要发布的结果,则生成失败。


codeCoverageRestoreOriginalPomXml - 执行任务后还原原始 pom.xml
输入别名: restoreOriginalPomXmlboolean. 可选。 在 时 codeCoverageTool != None使用 。 默认值:false

修改代码覆盖率 pom.xml 以生成结果。 如果需要保留原始 pom.xml,请使用此选项。


javaHomeOption - 设置JAVA_HOME依据
输入别名: javaHomeSelectionstring. 必需。 允许的值: JDKVersion (JDK 版本) 。 Path 默认值:JDKVersion

通过选择将在生成期间发现的 JDK 版本或通过手动输入 JDK 路径来设置 JAVA_HOME


jdkVersionOption - JDK 版本
输入别名: jdkVersionstring. 可选。 在 时 javaHomeSelection = JDKVersion使用 。 允许的值: default1.17 (JDK 17) 、 1.11 (JDK 11) 、 1.10 (JDK 10 (支持) ) 、 1.9 (JDK 9 (退出支持) ) 、 1.8 (JDK 8) 、 1.7 (JDK 7) 、 1.6 (JDK 6 (支持) ) 。 默认值:default

尝试发现所选 JDK 版本的路径并相应地设置 JAVA_HOME


jdkVersionOption - JDK 版本
输入别名: jdkVersionstring. 可选。 在 时 javaHomeSelection = JDKVersion使用 。 允许的值: default1.11 (JDK 11) 、 1.10 (JDK 10 (不支持) ) 、 1.9 (JDK 9 (不支持) ) 、 1.8 (JDK 8) 、 1.7 (JDK 7) 、 1.6 (JDK 6 (支持) ) 。 默认值:default

尝试发现所选 JDK 版本的路径并相应地设置 JAVA_HOME


jdkDirectory - JDK 路径
输入别名: jdkUserInputPathstring. 当 javaHomeSelection = Path 时,需要此选项。

将 设置为 JAVA_HOME 给定路径。


jdkArchitectureOption - JDK 体系结构
输入别名: jdkArchitecturestring. 可选。 在 时 jdkVersion != default使用 。 允许的值:x86x64。 默认值:x64

提供 JDK 的体系结构 (x86) x64


mavenVersionOption - Maven 版本
输入别名: mavenVersionSelectionstring. 必需。 允许的值: DefaultPath (自定义路径) 。 默认值:Default

使用默认 Maven 版本或指定自定义路径中的版本。


mavenDirectory - Maven 路径
输入别名: mavenPathstring. 当 mavenVersionSelection = Path 时,需要此选项。

指定 Maven 安装 (的自定义路径,例如: /usr/share/maven) 。


mavenSetM2Home - 设置M2_HOME变量
boolean. 可选。 在 时 mavenVersionSelection = Path使用 。 默认值:false

M2_HOME 变量设置为自定义 Maven 安装路径。


mavenOptions - 将MAVEN_OPTS设置为
输入别名: mavenOptsstring. 默认值:-Xmx1024m

MAVEN_OPTS设置环境变量,该变量用于发送命令行参数以启动 JVM。 标志 -Xmx 指定 JVM 可用的最大内存。


mavenAuthenticateFeed - 使用项目源进行身份验证
输入别名: mavenFeedAuthenticateboolean. 默认值:true

使用 Azure Artifacts 源自动进行身份验证。 如果未使用项目源,请取消选择此选项以加快生成速度。


mavenAuthenticateFeed - 对内置 Maven 源进行身份验证
输入别名: mavenFeedAuthenticateboolean. 默认值:true

使用 Azure Artifacts 源自动进行身份验证。 如果未使用项目源,请取消选择此选项以加快生成速度。


sonarQubeRunAnalysis - 运行 SonarQube 或 SonarCloud 分析
输入别名: sqAnalysisEnabledboolean. 默认值:false

此选项已从使用 Maven 任务版本 1 更改为使用 SonarQubeSonarCloud 市场扩展。
启用此选项可在执行Goals字段中的目标后运行 SonarQube 或 SonarCloud 分析。 应首先运行 安装 目标。 在此 Maven 任务之前,还必须将某个扩展中的 准备分析配置 任务添加到生成管道。


isJacocoCoverageReportXML - 使用 XML Jacoco 报表进行 SonarQube 分析
boolean. 可选。 在 时 sqAnalysisEnabled = true && codeCoverageTool = JaCoCo使用 。 默认值:false

使用 XML Jacoco 报表进行 SonarQube 分析。 详细了解 测试报告


sqMavenPluginVersionChoice - 适用于 Maven 版本的 SonarQube 扫描仪
string. 当 sqAnalysisEnabled = true 时,需要此选项。 允许的值: latest (使用最新版本) , pom (pom.xml) 中声明的使用版本。 默认值:latest

指定要使用的 SonarQube Maven 插件版本。 可以使用最新版本,也可以依赖于 中的 pom.xml版本。


checkStyleRunAnalysis - 运行检查方式
输入别名: checkstyleAnalysisEnabledboolean. 默认值:false

使用默认的 Sun 检查运行 Checkstyle 工具。 结果将作为生成工件上传。


pmdRunAnalysis - 运行 PMD
输入别名: pmdAnalysisEnabledboolean. 默认值:false

使用 PMD 静态分析工具查找代码中的 bug。 结果将作为生成工件上传。


findBugsRunAnalysis - 运行 FindBugs
输入别名: findbugsAnalysisEnabledboolean. 默认值:false

使用 FindBugs 静态分析工具查找代码中的 bug。 结果将作为生成工件上传。


任务控制选项

除了任务输入,所有任务都有控制选项。 有关详细信息,请参阅 控制选项和常见任务属性

输出变量

无。

备注

SonarQube 分析的配置已移动到任务准备分析配置中的 SonarQubeSonarCloud 扩展。

要求

要求 说明
管道类型 YAML,经典内部版本,经典版本
运行平台 Agent、DeploymentGroup
需求 自承载代理必须具有满足以下要求的功能才能运行使用此任务的作业:maven
功能 此任务不满足作业中后续任务的任何要求。
命令限制 任意
可设置的变量 任意
代理版本 1.89.0 或更高版本
任务类别 构建

另请参阅