mvn script isn't setting maven.home correctly with cygwin on xp
---------------------------------------------------------------

                 Key: MNG-3085
                 URL: http://jira.codehaus.org/browse/MNG-3085
             Project: Maven 2
          Issue Type: Bug
          Components: Command Line
    Affects Versions: 2.0.7
            Reporter: Brian Fox



The script is generating the following execution:
{noformat} 
/cygdrive/c/program files/java/jdk1.5.0_11/bin/java -classpath c:\program files\
maven2/boot/classworlds-1.1.jar -Dclassworlds.conf=c:\program files\maven2/bin/m
2.conf -Dmaven.home=c:\program files\maven2 org.codehaus.classworlds.Launcher
{noformat} 

In the invoker, it attempts to read the env to find the maven executable. 
Augmented with debug;
{code:title=MavenCommandLineBuilder.java|borderStyle=solid}
   if ( mavenHome == null )
        {
            String mavenHomeProperty = System.getProperty( "maven.home" );
            System.out.println("maven.home="+mavenHomeProperty);
            if ( mavenHomeProperty != null )
            {
                mavenHome = new File( mavenHomeProperty );
                System.out.println("mavenHome="+mavenHome.getAbsolutePath());
                
System.out.println("mavenHome.isDirectory="+mavenHome.isDirectory());
                if ( !mavenHome.isDirectory() )
                {
                    File binDir = mavenHome.getParentFile();
                    System.out.println("binDir="+binDir);
                    if ( "bin".equals( binDir.getName() ) )
                    {
                        // ah, they specified the mvn executable instead...
                        mavenHome = binDir.getParentFile();
                    }
                    else
                    {
                        throw new IllegalStateException( "${maven.home} is not 
specified as a directory: \'"
                            + mavenHomeProperty + "\'." );
                    }
                }
            }
{code}

Results in:
{noformat} 
maven.home=${env.M2_HOME}
mavenHome=e:\svn\maven\maven-plugins\maven-eclipse-plugin\${env.M2_HOME}
mavenHome.isDirectory=false
binDir=null
{noformat} 

And crashes on  if ( "bin".equals( binDir.getName() ) )

I tried modifying the cygpath commands to remove the space and reverse the 
backslashes in the -Dmaven.home= but none of them seemed to work.

-- 
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

        

Reply via email to