แชร์ผ่าน


Maven@1 - Maven v1 task

Use this task to build with Apache Maven.

Inputs

mavenPOMFile - Maven POM file
string. Required. Default value: pom.xml.

Specifies the relative path from the repository root to the Maven POM file.


goals - Goal(s)
string. Default value: package.


options - Options
string.


publishJUnitResults - Publish to TFS/Team Services
boolean. Default value: true.

Specifies the option to publish the JUnit test results produced by the Maven build to TFS/Team Services. Each test results file matching Test Results Files will be published as a test run in TFS/Team Services.


testResultsFiles - Test Results Files
string. Required when publishJUnitResults = true. Default value: **/TEST-*.xml.

Specifies the path and pattern of the test results files to publish. For example, **/TEST-*.xml for all XML files with a name that starts with TEST-. If no root path is specified, files are matched beneath the default working directory, the value of which is available in the variable $(System.DefaultWorkingDirectory). For example, a value of **/TEST-*.xml will actually result in matching files from $(System.DefaultWorkingDirectory)/**/TEST-*.xml.


testRunTitle - Test Run Title
string. Optional. Use when publishJUnitResults = true.

Specifies a name for the test run.


codeCoverageToolOption - Code Coverage Tool
Input alias: codeCoverageTool. string. Allowed values: None, Cobertura, JaCoCo. Default value: None.

Specifies the code coverage tool.


codeCoverageClassFilter - Class Inclusion/Exclusion Filters
Input alias: classFilter. string. Optional. Use when codeCoverageTool != None.

Specifies a comma-separated list of filters to include or exclude classes from collecting code coverage. For example, +:com.*,+:org.*,-:my.app*.*.


codeCoverageClassFilesDirectories - Class Files Directories
Input alias: classFilesDirectories. string. Optional. Use when codeCoverageTool = JaCoCo.

This field is required for a multi-module project.
Specifies a comma-separated list of relative paths from the Maven POM file to the directories containing class files and archive files (JAR, WAR, etc.). Code coverage is reported for class files in these directories. For example, target/classes,target/testClasses.


codeCoverageSourceDirectories - Source Files Directories
Input alias: srcDirectories. string. Optional. Use when codeCoverageTool = JaCoCo.

This field is required for a multi-module project.
Specifies a comma-separated list of relative paths from the Maven POM file to source code directories. Code coverage reports will use these to highlight source code. For example, src/java,src/Test.


codeCoverageFailIfEmpty - Fail When Code Coverage Results Are Missing
Input alias: failIfCoverageEmpty. boolean. Optional. Use when codeCoverageTool != None. Default value: false.

Fails the build if code coverage did not produce any results to publish.


javaHomeOption - Set JAVA_HOME by
Input alias: javaHomeSelection. string. Required. Allowed values: JDKVersion (JDK Version), Path. Default value: JDKVersion.

Sets JAVA_HOME either by selecting a JDK version that will be discovered during builds or by manually entering a JDK path.


jdkVersionOption - JDK Version
Input alias: jdkVersion. string. Optional. Use when javaHomeSelection = JDKVersion. Allowed values: default, 1.9 (JDK 9), 1.8 (JDK 8), 1.7 (JDK 7), 1.6 (JDK 6). Default value: default.

Attempts to discover the path to the selected JDK version, and sets JAVA_HOME accordingly.


jdkDirectory - JDK Path
Input alias: jdkUserInputPath. string. Required when javaHomeSelection = Path.

Sets JAVA_HOME to the given path.


jdkArchitectureOption - JDK Architecture
Input alias: jdkArchitecture. string. Optional. Use when jdkVersion != default. Allowed values: x86, x64. Default value: x64.

Supplies the architecture (x86, x64) of the JDK.


mavenVersionOption - Maven Version
Input alias: mavenVersionSelection. string. Required. Allowed values: Default, Path (Custom Path). Default value: Default.

Uses either the default Maven version or the version in the specified custom path.


mavenDirectory - Maven Path
Input alias: mavenPath. string. Required when mavenVersionSelection = Path.

Supplies the custom path to the Maven installation (for example: /usr/share/maven).


mavenSetM2Home - Set M2_HOME variable
boolean. Optional. Use when mavenVersionSelection = Path. Default value: false.

Sets the M2_HOME variable to a custom Maven installation path.


mavenOptions - Set MAVEN_OPTS to
Input alias: mavenOpts. string. Default value: -Xmx1024m.

Sets the MAVEN_OPTS environment variable, which is used to send command-line arguments to start the JVM. The -Xmx flag specifies the maximum memory available to the JVM.


mavenAuthenticateFeed - Authenticate built-in Maven feeds
Input alias: mavenFeedAuthenticate. boolean. Default value: true.

Automatically authenticates with Azure Artifacts feeds. If Artifacts feeds are not in use, deselect this option for faster builds.


sonarQubeRunAnalysis - Run SonarQube Analysis
Input alias: sqAnalysisEnabled. boolean. Default value: false.

Runs a SonarQube analysis after executing the current goals. install or package goals should be executed first.


sonarQubeServiceEndpoint - SonarQube Endpoint
Input alias: sqConnectedServiceName. string. Required when sqAnalysisEnabled = true.

Specifies the SonarQube server generic endpoint.


sonarQubeProjectName - SonarQube Project Name
Input alias: sqProjectName. string. Optional. Use when sqAnalysisEnabled = true.

Specifies the SonarQube project name, for example sonar.projectName.


sonarQubeProjectKey - SonarQube Project Key
Input alias: sqProjectKey. string. Optional. Use when sqAnalysisEnabled = true.

Specifies the SonarQube project unique key, for example sonar.projectKey.


sonarQubeProjectVersion - SonarQube Project Version
Input alias: sqProjectVersion. string. Optional. Use when sqAnalysisEnabled = true.

Specifies the SonarQube project version, for example sonar.projectVersion.


sonarQubeSpecifyDB - The SonarQube server version is lower than 5.2
Input alias: sqDbDetailsRequired. boolean. Optional. Use when sqAnalysisEnabled = true. Default value: false.

If using a SonarQube server 5.1 or lower, you must specify the database connection details.


sonarQubeDBUrl - Db Connection String
Input alias: sqDbUrl. string. Optional. Use when sqDbDetailsRequired = true.

Use for SonarQube server 5.1 and lower only.
Specifies the database connection setting (for example, sonar.jdbc.url or jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor).


sonarQubeDBUsername - Db Username
Input alias: sqDbUsername. string. Optional. Use when sqDbDetailsRequired = true.

Use for SonarQube server 5.1 and lower only.
Specifies the username for the database user (for example, sonar.jdbc.username).


sonarQubeDBPassword - Db User Password
Input alias: sqDbPassword. string. Optional. Use when sqDbDetailsRequired = true.

Use for SonarQube server 5.1 and lower only.
Specifies the password for the database user (for example, sonar.jdbc.password).


sonarQubeIncludeFullReport - Include full analysis report in the build summary (SQ 5.3+)
Input alias: sqAnalysisIncludeFullReport. boolean. Optional. Use when sqAnalysisEnabled = true. Default value: true.

This option will delay the build until the SonarQube analysis is completed.


sonarQubeFailWhenQualityGateFails - Fail the build on quality gate failure (SQ 5.3+)
Input alias: sqAnalysisBreakBuildIfQualityGateFailed. boolean. Optional. Use when sqAnalysisEnabled = true.

This option is only available when using a SonarQube server 5.3 or above. Introduces delays, as the build must wait for SonarQube to complete the analysis. More information about SonarQube quality gates.


checkStyleRunAnalysis - Run Checkstyle
Input alias: checkstyleAnalysisEnabled. boolean. Default value: false.

Runs the Checkstyle tool with the default Sun checks. Results are uploaded as build artifacts.


pmdRunAnalysis - Run PMD
Input alias: pmdAnalysisEnabled. boolean. Default value: false.

Uses the PMD static analysis tool to look for bugs in the code. Results are uploaded as build artifacts.


findBugsRunAnalysis - Run FindBugs
Input alias: findbugsAnalysisEnabled. boolean. Default value: false.

Uses the FindBugs static analysis tool to look for bugs in the code. Results are uploaded as build artifacts.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands Self-hosted agents must have capabilities that match the following demands to run jobs that use this task: maven
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 1.89.0 or greater
Task category Build

See also