maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Osipov (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (MNG-5824) Support MAVEN_ARGS environment variable as a way of supplying default command line arguments
Date Tue, 24 Jan 2017 19:35:26 GMT

    [ https://issues.apache.org/jira/browse/MNG-5824?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14543758#comment-14543758
] 

Michael Osipov edited comment on MNG-5824 at 1/24/17 7:35 PM:
--------------------------------------------------------------

Here is how it could work:

{noformat}
diff --git a/apache-maven/src/bin/mvn b/apache-maven/src/bin/mvn
index 902de4a..7f3eefe 100755
--- a/apache-maven/src/bin/mvn
+++ b/apache-maven/src/bin/mvn
@@ -31,6 +31,8 @@
 #   MAVEN_OPTS - parameters passed to the Java VM when running Maven
 #     e.g. to debug Maven itself, use
 #       set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+#   MAVEN_ARGS - parameters passed to Maven. Useful for settings defaults
+#     e.g. MAVEN_ARGS="--settings $HOME/settings.xml"
 #   MAVEN_SKIP_RC - flag to disable loading of mavenrc files
 # ----------------------------------------------------------------------------
 
@@ -221,7 +223,7 @@ MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
 
 # Provide a "standardized" way to retrieve the CLI args that will 
 # work with both Windows and non-Windows executions.
-MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $MAVEN_ARGS $@"
 export MAVEN_CMD_LINE_ARGS
 
 exec "$JAVACMD" \
@@ -229,4 +231,4 @@ exec "$JAVACMD" \
   -classpath "${M2_HOME}"/boot/plexus-classworlds-*.jar \
   "-Dclassworlds.conf=${M2_HOME}/bin/m2.conf" \
   "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}"
\
-  ${CLASSWORLDS_LAUNCHER} "$@"
+  ${CLASSWORLDS_LAUNCHER} $MAVEN_CMD_LINE_ARGS
{noformat}


was (Author: brianstclair):
Here is how it could work:

diff --git a/apache-maven/src/bin/mvn b/apache-maven/src/bin/mvn
index 902de4a..7f3eefe 100755
--- a/apache-maven/src/bin/mvn
+++ b/apache-maven/src/bin/mvn
@@ -31,6 +31,8 @@
 #   MAVEN_OPTS - parameters passed to the Java VM when running Maven
 #     e.g. to debug Maven itself, use
 #       set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+#   MAVEN_ARGS - parameters passed to Maven. Useful for settings defaults
+#     e.g. MAVEN_ARGS="--settings $HOME/settings.xml"
 #   MAVEN_SKIP_RC - flag to disable loading of mavenrc files
 # ----------------------------------------------------------------------------
 
@@ -221,7 +223,7 @@ MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
 
 # Provide a "standardized" way to retrieve the CLI args that will 
 # work with both Windows and non-Windows executions.
-MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $MAVEN_ARGS $@"
 export MAVEN_CMD_LINE_ARGS
 
 exec "$JAVACMD" \
@@ -229,4 +231,4 @@ exec "$JAVACMD" \
   -classpath "${M2_HOME}"/boot/plexus-classworlds-*.jar \
   "-Dclassworlds.conf=${M2_HOME}/bin/m2.conf" \
   "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}"
\
-  ${CLASSWORLDS_LAUNCHER} "$@"
+  ${CLASSWORLDS_LAUNCHER} $MAVEN_CMD_LINE_ARGS


> Support MAVEN_ARGS environment variable as a way of supplying default command line arguments
> --------------------------------------------------------------------------------------------
>
>                 Key: MNG-5824
>                 URL: https://issues.apache.org/jira/browse/MNG-5824
>             Project: Maven
>          Issue Type: New Feature
>          Components: Command Line
>    Affects Versions: 3.3.3
>            Reporter: Brian St.Clair
>
> I would like to be able to specify default Maven command line arguments using the MAVEN_ARGS
environment variable, similarly to how I can use MAVEN_OPTS to specify default JVM args.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message