Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maven task: Maven wrapper support #9242

Closed
ahaeber opened this issue Jan 4, 2019 · 10 comments
Closed

Maven task: Maven wrapper support #9242

ahaeber opened this issue Jan 4, 2019 · 10 comments
Assignees

Comments

@ahaeber
Copy link

ahaeber commented Jan 4, 2019

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.

@mitchdenny
Copy link
Member

Adding @zjrunner and @alexmullans for consideration.

@joshmgross
Copy link
Member

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 joshmgross self-assigned this Jan 7, 2019
@ahaeber
Copy link
Author

ahaeber commented Jan 8, 2019

@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

@joshmgross
Copy link
Member

@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.

@thorntonrp
Copy link

thorntonrp commented Jan 18, 2022

The Maven wrapper is now an official part of Maven 3 ( see https://maven.apache.org/wrapper/ ).

The maven-wrapper-plugin supported for all versions of Maven 3 using the command mvn wrapper:wrapper. Running that command should be part of project setup since the wrapper script should be added to source control, so the Azure pipeline Maven task doesn't need to execute the plugin. It just needs an option to pass the Maven arguments to the mvnw wrapper script that is included from source control instead of $MAVEN_HOME/bin/mvn.

Also, regardless of whether a project includes a wrapper script generated by the official Maven plugin or the Takari plugin, the wrapper script by definition must act identically to the default Maven command.

@Tetradeus
Copy link

Tetradeus commented May 8, 2022

I did manage to bypass it with a symbolic link + temp path :

ln -s ../../mvnw mvn
        - bash: |
            echo "##vso[task.setvariable variable=path;]$PATH:$(Build.SourcesDirectory)/.mvn/bin"

@sreich
Copy link

sreich commented Jan 6, 2023

seconding this, the maven wrapper should be considered a part of maven, just like the gradle wrapper is a part of gradle and i would expect my CICD tools to support what other tools have been able to.

@derTobsch
Copy link

Please reconsider, a lot of things changed. The wrapper is now a part of maven.

@GustavoOS
Copy link

@joshmgross any chance for this to be reconsidered as Wrapper is now a part of maven?

@chunhuihu
Copy link

chunhuihu commented Apr 18, 2024

Apache Flink is using maven wrapper now, as more and more open-source projects use maven wrapper, could your reconsider to add wrapper support to maven task?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants