Azure-pipelines-tasks: Maven task: Maven wrapper support

Created on 4 Jan 2019  路  4Comments  路  Source: microsoft/azure-pipelines-tasks

Currently it does not seem possible to use the Maven wrapper (see https://github.com/takari/maven-wrapper) with the Maven task. The Maven task has various ways for configuring the path, but at the end it is hardcoded to use 'mvn' as the executable name. Usually the Maven wrapper is named 'mvnw'.

A way to simply specify the Maven path + command name would be helpful. Actually that will be the same as mvnExec that is created now. Could introduce a new variable in task.json named "mvnExec" which is mutually exclusive to mavenPath, mavenSetM2Home and mavenVersionSelection. If "mvnExec" is specificed then simply use that.

CrossPlatform

All 4 comments

Adding @zjrunner and @alexmullans for consideration.

Hey @ahaeber, we don't have any plans to add support for the Maven wrapper in the Maven task.

If you want to use the Maven wrapper, you can set up a build script to install it and run all the Maven commands that the Maven task is running for your build.

Alternatively, you can create a Maven wrapper extension that would do as you described to allow a custom maven executable. For info on creating an extension, see: https://docs.microsoft.com/en-us/azure/devops/extend/develop/add-build-task?view=vsts

@joshmgross creating a separate build extension for this seems like a lot of work because I will then have to keep it aligned with the standard Maven task. Would you consider a PR by me to add this functionality? I believe it will mainly be some changes at https://github.com/Microsoft/azure-pipelines-tasks/blob/master/Tasks/MavenV3/maventask.ts#L47

@ahaeber We try to keep the tasks as light as possible to make them maintainable and since this is a 3rd party maven tool we won't add it to the task.

A separate build extension is definitely a lot of extra work. I'd recommend writing a script to install maven wrapper and call the maven commands to run your build.

Was this page helpful?
0 / 5 - 0 ratings