apache / apache/maven

[MNG-7541] Native support for PowerShell to start Maven

Open
#8,909 10 comments 0 reactions 0 assignees View on GitHub
enhancement priority:trivial
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

**[Jurrian Fahner](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=jfahner)** opened **[MNG-7541](https://issues.apache.org/jira/browse/MNG-7541?redirect=false)** and commented

Maven has two files in the bin dir:
|command|its use|
|:---|:---|
|mvn|POSIX shell|
|mvn.cmd|cmd.exe|

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. ;)

It is not the case (as far as I know that Microsoft is going to deprecate cmd.exe in favor of powershell: https://devblogs.microsoft.com/commandline/rumors-of-cmds-death-have-been-greatly-exaggerated/

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.

---

**Affects:** 3.8.3

**Issue Links:**
- [MNG-7557](https://issues.apache.org/jira/browse/MNG-7557) Rewrite Batch scripts (**.cmd) in PowerShell (**.ps1)
(_**"is duplicated by"**_)
- [MSHARED-1150](https://issues.apache.org/jira/browse/MSHARED-1150) Support for PowerShell Maven executable

- [MWRAPPER-78](https://issues.apache.org/jira/browse/MWRAPPER-78) Rewrite mvnw.cmd in PowerShell (mvnw.ps1)

**Remote Links:**
- [GitHub Pull Request #877
](https://github.com/apache/maven/pull/877)
- [GitHub Pull Request #878
](https://github.com/apache/maven/pull/878)
- [GitHub Pull Request #982
](https://github.com/apache/maven/pull/982)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.