You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[MNG-7541] Native support for PowerShell to start Maven #8909
On windows there are two ways to write scripts, by using cmd.exe or using powershell.
If you enter mvn in powershell it will look for mvn.ps1 on the PATH first. If it doesn't find anything it will execute mvn.cmd as fall-back.
When running maven for starting a server for development purposes and you do ctrl-c to exit the server it will ask the question: Terminate batch job (Y/N)?
As far as I know it is default behaviour of cmd.exe.
Well if I don't want to terminate, I wouldn't press ctrl-c. ;)
Allthough I think it would be a good move for maven to have also a powershell script as well... It is possible to integrate elegant support for native help in powershell, get-help mvn.
But it also increases the maintenance effort as well. I don't know whether this cost outweigh the benefits, though...
By the way I would happy to contribute if it is appreciated.
Powershell is available since windows 7. Windows 10 and/or 11 are nowadays the base for many developer laptops/PCs.
We can get rid of cmd.exe script and replace it with powershell (which lowers maintainability effort), the mvn.cmd script will hold something like:
PowerShell.exe -command mvn.ps1
It will likely not have a life altering impact probably... ;)
Jurrian Fahner, please note that in Maven 4 the start scripts have been broken up into single components. This is what you have to provide also. The scripts have been simplified in Maven 4 and aren't compatible with Maven 3.
Activity
jira-importer commentedon Sep 19, 2022
Michael Osipov commented
I have tought about this and the only benefit I see is that variables aren't automatically exported. What else?
jira-importer commentedon Sep 19, 2022
Jurrian Fahner commented
PowerShell.exe -command mvn.ps1
It will likely not have a life altering impact probably... ;)
jira-importer commentedon Oct 4, 2022
Michael Osipov commented
I'd be in favor to review a PR. One issue is though that some of our components might explicitly call
mvn.cmd.jira-importer commentedon Oct 4, 2022
Michael Osipov commented
Those need to be reviewed:
I can take cake of Maven SCM, sjaranowski, do you want to address Invoker?
jira-importer commentedon Oct 7, 2022
Jurrian Fahner commented
Michael Osipov Shall I create a PR based on the implementation for mvn.ps1?
We also need to take care of the mvnw.cmd. Do we want to have it in one PR or can we implement the functionality in several PRs?
jira-importer commentedon Oct 7, 2022
Michael Osipov commented
Core and Wrapper are two projects. So separate PRs. Willing to review mvn.ps1.
jira-importer commentedon Oct 8, 2022
Michael Osipov commented
Jurrian Fahner, please note that in Maven 4 the start scripts have been broken up into single components. This is what you have to provide also. The scripts have been simplified in Maven 4 and aren't compatible with Maven 3.
jira-importer commentedon Feb 7, 2023
Guillaume Nodet commented
I wonder if it would make sense to remove the
.cmdscript instead of keeping both.ps1and.cmdscripts.jira-importer commentedon Feb 7, 2023
Michael Osipov commented
This needs to be fully tested at least with all of our components and properly announced. Not trivial.
jira-importer commentedon Mar 26, 2025
Guillaume Nodet commented
Is this an effort we want to pursue ?
Do we need both scripts or should we get rid of the cmd script and use that one ?