Maven Compiler Plugin
  1. Maven Compiler Plugin
  2. MCOMPILER-74

build failure when executable path contains spaces

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.2, 2.1
    • Fix Version/s: 2.1
    • Labels:
      None
    • Environment:
      windows xp, maven 2.0.9
    • Number of attachments :
      0

      Description

      When compiling a project with an executable that has spaces in its path, a build failure is encountered. This can be reproduced by following the exact example given on the Maven Compiler Plugin home page (http://maven.apache.org/plugins/maven-compiler-plugin/examples/compile-using-different-jdk.html)

      This seems to be already mentioned in MCOMPILER-30 (which is closed) but there is a comment after it was closed stating it still doesn't work.

      One potential solution I have found is to use version 1.5.1 of plexus-utils - should this be updated in the maven-compiler-plugin's pom or is there a better solution?

      [INFO] -------------------------------------------------------------
      [INFO] ------------------------------------------------------------------------
      [ERROR] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Compilation failure
      Failure executing javac, but could not parse the error:
      'C:\Program' is not recognized as an internal or external command,
      operable program or batch file.

      Failure executing javac, but could not parse the error:
      'C:\Program' is not recognized as an internal or external command,
      operable program or batch file.

      [INFO] ------------------------------------------------------------------------
      [INFO] Trace
      org.apache.maven.BuildFailureException: Compilation failure
      Failure executing javac, but could not parse the error:
      'C:\Program' is not recognized as an internal or external command,
      operable program or batch file.

      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:579)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
      at java.lang.reflect.Method.invoke(Method.java:391)
      at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
      at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
      at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
      at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
      Failure executing javac, but could not parse the error:
      'C:\Program' is not recognized as an internal or external command,
      operable program or batch file.

      at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:562)
      at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:115)
      at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
      ... 17 more
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 2 seconds
      [INFO] Finished at: Mon May 19 16:54:59 CDT 2008
      [INFO] Final Memory: 6M/19M
      [INFO] ------------------------------------------------------------------------

        Activity

        Hide
        Vincent Siveton added a comment -

        Already fixed in r653059

        Show
        Vincent Siveton added a comment - Already fixed in r653059
        Hide
        Hilal Ram added a comment -

        The issue still exist even in 2.2

        I'm still facing this issue. Simply Because I have the Oracle installed on Program files and it's PATH is causing the build to fai
        Any Quick Fix on this ???

        [ERROR] BUILD FAILURE
        [INFO] ------------------------------------------------------------------------
        [INFO] Compilation failure
        Failure executing javac, but could not parse the error:
        'C:\Program' is not recognized as an internal or external command,
        operable program or batch file.

        [INFO] ------------------------------------------------------------------------
        [INFO] Trace
        org.apache.maven.BuildFailureException: Compilation failure
        Failure executing javac, but could not parse the error:
        'C:\Program' is not recognized as an internal or external command,
        operable program or batch file.

        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
        ultLifecycleExecutor.java:699)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi
        fecycle(DefaultLifecycleExecutor.java:540)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
        ltLifecycleExecutor.java:519)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
        dleFailures(DefaultLifecycleExecutor.java:371)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
        ts(DefaultLifecycleExecutor.java:332)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
        fecycleExecutor.java:181)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:4
        1)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

        Show
        Hilal Ram added a comment - The issue still exist even in 2.2 I'm still facing this issue. Simply Because I have the Oracle installed on Program files and it's PATH is causing the build to fai Any Quick Fix on this ??? [ERROR] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Compilation failure Failure executing javac, but could not parse the error: 'C:\Program' is not recognized as an internal or external command, operable program or batch file. [INFO] ------------------------------------------------------------------------ [INFO] Trace org.apache.maven.BuildFailureException: Compilation failure Failure executing javac, but could not parse the error: 'C:\Program' is not recognized as an internal or external command, operable program or batch file. at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa ultLifecycleExecutor.java:699) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi fecycle(DefaultLifecycleExecutor.java:540) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau ltLifecycleExecutor.java:519) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan dleFailures(DefaultLifecycleExecutor.java:371) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen ts(DefaultLifecycleExecutor.java:332) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi fecycleExecutor.java:181) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137) at org.apache.maven.cli.MavenCli.main(MavenCli.java:362) at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:4 1) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
        Hide
        Vincent Siveton added a comment -

        Hilal, you need to use the compiler plugin 2.1-SNAPSHOT
        I just deployed a new snapshot and you need to add the following in your pom:

         <pluginRepository>
           <id>apache.snapshots</id>
           <url>http://repository.apache.org/snapshots</url>
           <releases>
             <enabled>false</enabled>
            </releases>
         </pluginRepository>
        
        Show
        Vincent Siveton added a comment - Hilal, you need to use the compiler plugin 2.1-SNAPSHOT I just deployed a new snapshot and you need to add the following in your pom: <pluginRepository> <id>apache.snapshots</id> <url>http://repository.apache.org/snapshots</url> <releases> <enabled>false</enabled> </releases> </pluginRepository>
        Hide
        Neil Williamson added a comment -

        I was getting a similar issue, with the message:
        Failure executing javac, but could not parse the error:
        'C:\Program' is not recognized as an internal or external command,
        operable program or batch file.

        Adding the pluginRepository mentioned above did not resolve the problem for me

        The solution I found that worked was to simply change the path to my jdk in my environment variables from C:\Program Files\... to C:\Progra~1\...

        Show
        Neil Williamson added a comment - I was getting a similar issue, with the message: Failure executing javac, but could not parse the error: 'C:\Program' is not recognized as an internal or external command, operable program or batch file. Adding the pluginRepository mentioned above did not resolve the problem for me The solution I found that worked was to simply change the path to my jdk in my environment variables from C:\Program Files\... to C:\Progra~1\...

          People

          • Assignee:
            Vincent Siveton
            Reporter:
            Greg Hengeli
          • Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: