Cygwin mvn script modifies CLASSPATH environment variable
---------------------------------------------------------
Key: MNG-4956
URL: http://jira.codehaus.org/browse/MNG-4956
Project: Maven 2 & 3
Issue Type: Bug
Components: Command Line
Affects Versions: 3.0
Environment: Cygwin on Windowx
Reporter: Zemian Deng
When running in Cygwin, the apache-maven-3.0/bin/mvn script actually changed
the user env CLASSPATH to an invalid Java classpath value, which is unexpected!
To repeat this, try the following on Cygwin:
Create this simple pom.xml in an project:
{code:xml}
<?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>deng</groupId>
<artifactId>mvn-examples</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<configuration>
<target>
<echo message="Maven env.CLASSPATH: ${env.CLASSPATH}" />
</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
{code:xml}
{code}
$ /apps/apache-maven-3.0/bin/mvn -v
Apache Maven 3.0 (r1004208; 2010-10-04 07:50:56-0400)
Java version: 1.6.0_19
Java home: C:\apps\jdk1.6.0_19\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
$ export CLASSPATH="C:\\my-classes;C:\\my-lib\app.jar"
$ echo $CLASSPATH
C:\my-classes;C:\my-lib\app.jar
$ /apps/apache-maven-3.0/bin/mvn antrun:run
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building mvn-examples 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-antrun-plugin:1.6:run (default-cli) @ mvn-examples ---
[INFO] Executing tasks
main:
[echo] Maven env.CLASSPATH:
/cygdrive/c/my-classes:/cygdrive/c/my-lib/app.jar
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.843s
[INFO] Finished at: Wed Dec 29 23:37:41 EST 2010
[INFO] Final Memory: 2M/15M
[INFO] ------------------------------------------------------------------------
{code}
NOTE 1: The CLASSPATH value has been modified with cygwin path prefix, which
become an invalid Java classpath value!
NOTE 2: If I use mvn.bat in cygwin shell, it will work as expected. So this
only affect the mvn shell script only.
NOTE 3: This only affect the variable "CLASSPATH", b/c if I use JAVA_CLASSPATH,
the value didn't change.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira