You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Michael Osipov (Jira)" <ji...@apache.org> on 2021/07/21 19:37:00 UTC
[jira] [Commented] (MNG-6648) Add command line parameters in
'mavenrc_pre' script
[ https://issues.apache.org/jira/browse/MNG-6648?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17385078#comment-17385078 ]
Michael Osipov commented on MNG-6648:
-------------------------------------
This case is perfectly valid, actually this is a bug. In the Bourne shell script we do source {{mavenrc}} which is part of the {{mvn}} script now and has full access to {{"$@"}}. In Windows Command Prompt there is no equivalent to the source commmand. Therefore, we use {{call}}, but shall is rather similiar to invoking another script and that script won't have access to the arguments passed to {{mvn.cmd}}. For that reason [~axel3rd], is right, we need to do:
{noformat}
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
{noformat}
> Add command line parameters in 'mavenrc_pre' script
> ---------------------------------------------------
>
> Key: MNG-6648
> URL: https://issues.apache.org/jira/browse/MNG-6648
> Project: Maven
> Issue Type: Improvement
> Components: Command Line
> Affects Versions: 3.6.0, 3.6.1
> Reporter: Alix Lourme
> Priority: Major
> Labels: command-line, script
> Fix For: waiting-for-feedback
>
>
> Hello,
> In some corner-case, you could have to run Maven with a custom {{JAVA_HOME}} (JDK v8, v11, ... even if it is evil some plugin can be impacted by JDK at runtime).
> If it is per-project, [JVM and Command Line Options|https://maven.apache.org/docs/3.3.1/release-notes.html#JVM_and_Command_Line_Options] is not relevant and update {{JAVA_HOME}} each time in your environment could be boring.
> A command line user-custom-parameter (ex : {{-Dmy.jdk=11}}) could be simple to achieve that.
> A Maven script wrapper could be implemented for that, but it's like update the Maven distribution => evil.
> The *mavenrc_pre* (MNGSITE-246) could be perfect for that feature !
> But currently command line parameters are not used in script :(.
> If parameters are used dor script call, sample for {{mvn.cmd}} (windows):
> {code}
> if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd %*"
> {code}
> It's allow any user customization, using Maven standards.
> If relevant, I can provide PR.
> Best regards
--
This message was sent by Atlassian Jira
(v8.3.4#803005)