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

Compiler fork executable fails when the path has spaces

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.0.1
    • Fix Version/s: None
    • Labels:
      None

      Description

      JAVA_1_3_HOME=C:\Program Files\Java\jdk1.3.1_18

      <plugin>
      <artifactId>maven-compiler-plugin</artifactId>
      <configuration>
      <fork>true</fork>
      <compilerVersion>1.3</compilerVersion>
      <executable>$

      {JAVA_1_3_HOME}

      /bin/javac</executable>
      </configuration>
      </plugin>

      Fails with

      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.

        Issue Links

          Activity

          Carlos Sanchez created issue -
          Carlos Sanchez made changes -
          Field Original Value New Value
          Link This issue depends upon PLX-161 [ PLX-161 ]
          Hide
          Carlos Sanchez added a comment -

          Same problem, is not the path having spaces, but not quoting the full command when using a shell executable

          Show
          Carlos Sanchez added a comment - Same problem, is not the path having spaces, but not quoting the full command when using a shell executable
          Hide
          Carlos Sanchez added a comment -

          Fixed upgrading plexus-compiler versions

          Show
          Carlos Sanchez added a comment - Fixed upgrading plexus-compiler versions
          Carlos Sanchez made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Assignee Carlos Sanchez [ carlos ]
          Resolution Fixed [ 1 ]
          Hide
          Carlos Sanchez added a comment -

          Merged to branch 2.0.x

          Show
          Carlos Sanchez added a comment - Merged to branch 2.0.x
          Carlos Sanchez made changes -
          Fix Version/s 2.1 [ 12304 ]
          Carlos Sanchez made changes -
          Link This issue is related to MSUREFIRE-88 [ MSUREFIRE-88 ]
          Hide
          Carlos Sanchez added a comment -

          Reopened to apply more PLX-161 changes

          Show
          Carlos Sanchez added a comment - Reopened to apply more PLX-161 changes
          Carlos Sanchez made changes -
          Resolution Fixed [ 1 ]
          Status Closed [ 6 ] Reopened [ 4 ]
          Hide
          Carlos Sanchez added a comment -

          Fixed in the plexus-compiler-javac again

          Show
          Carlos Sanchez added a comment - Fixed in the plexus-compiler-javac again
          Carlos Sanchez made changes -
          Resolution Fixed [ 1 ]
          Status Reopened [ 4 ] Closed [ 6 ]
          Carlos Sanchez made changes -
          Fix Version/s 2.1 [ 12304 ]
          Hide
          Bill added a comment -

          I am try to use this feature by plug-in version 2.0.2 (Maven 2.0.7). I still got the error:

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

          I have tried to put " " to enclose the value but still not working?

          I checked my plugin version (2.0.2). Is this issue has been addressed in this version?

          Thank you.

          Show
          Bill added a comment - I am try to use this feature by plug-in version 2.0.2 (Maven 2.0.7). I still got the error: Failure executing javac, but could not parse the error: 'C:\Program' is not recognized as an internal or external command, I have tried to put " " to enclose the value but still not working? I checked my plugin version (2.0.2). Is this issue has been addressed in this version? Thank you.
          Hide
          Greg Hengeli added a comment -

          I too am encountering this error. As (what I consider) a temporary solution, you can declare the dependency on plexus-utils to be version 1.5.1 in the plugin. My question is why isn't this version of the dependency declared in the maven-compiler-plugin's pom?! Is there another solution I am missing?

          <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>2.0.2</version>
          <configuration>
          <source>1.5</source>
          <target>1.5</target>
          <fork>true</fork>
          <executable>$

          {JAVA5_HOME}

          /bin/javac</executable>
          <compilerVersion>1.5</compilerVersion>
          </configuration>
          <dependencies>
          <!-- required to allow spaces in the executable path -->
          <dependency>
          <groupId>org.codehaus.plexus</groupId>
          <artifactId>plexus-utils</artifactId>
          <version>1.5.1</version>
          </dependency>
          </dependencies>
          </plugin>

          Show
          Greg Hengeli added a comment - I too am encountering this error. As (what I consider) a temporary solution, you can declare the dependency on plexus-utils to be version 1.5.1 in the plugin. My question is why isn't this version of the dependency declared in the maven-compiler-plugin's pom?! Is there another solution I am missing? <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> <configuration> <source>1.5</source> <target>1.5</target> <fork>true</fork> <executable>$ {JAVA5_HOME} /bin/javac</executable> <compilerVersion>1.5</compilerVersion> </configuration> <dependencies> <!-- required to allow spaces in the executable path --> <dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-utils</artifactId> <version>1.5.1</version> </dependency> </dependencies> </plugin>
          Hide
          Dan Rollo added a comment -

          I too am seeing this problem (using maven 2.0.9). I believe this issue is not fixed and will open a new jira issue to track it.

          help:effective-pom shows maven-compiler-plugin, version 2.0.2.

          Dan Rollo

          Show
          Dan Rollo added a comment - I too am seeing this problem (using maven 2.0.9). I believe this issue is not fixed and will open a new jira issue to track it. help:effective-pom shows maven-compiler-plugin, version 2.0.2. Dan Rollo
          Carlos Sanchez made changes -
          Link This issue is duplicated by MCOMPILER-79 [ MCOMPILER-79 ]
          Hide
          Carlos Sanchez added a comment -

          reopened per user comments

          Show
          Carlos Sanchez added a comment - reopened per user comments
          Carlos Sanchez made changes -
          Assignee Carlos Sanchez [ carlos ]
          Status Closed [ 6 ] Reopened [ 4 ]
          Resolution Fixed [ 1 ]
          Dan Rollo made changes -
          Link This issue is related to MCOMPILER-79 [ MCOMPILER-79 ]
          Hide
          Philip Schwarz added a comment -

          I am using Maven 2.0.9 and I have the problem even though there are no spaces in the path to the JDK :

          <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>2.0.2</version>
          <configuration>
          <verbose>true</verbose>
          <fork>true</fork>
          <source>1.5</source>
          <target>1.5</target>
          <compilerVersion>1.5</compilerVersion>
          <executable>C:/Views/KFL_1_0/vendors/etc/solaris/jdk1.5.0_05/bin/javac</executable>
          <meminitial>128m</meminitial>
          <maxmem>512m</maxmem>
          </configuration>
          </plugin>

          [ERROR] BUILD FAILURE
          [INFO] ------------------------------------------------------------------------
          [INFO] Compilation failure
          Failure executing javac, but could not parse the error:
          'C:\Views\KFL_1_0\vendors\etc\solaris\jdk1.5.0_05\bin\javac' is not recognized as an internal or external command,
          operable program or batch file.

          Failure executing javac, but could not parse the error:
          'C:\Views\KFL_1_0\vendors\etc\solaris\jdk1.5.0_05\bin\javac' 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:\Views\KFL_1_0\vendors\etc\solaris\jdk1.5.0_05\bin\javac' 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:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          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:\Views\KFL_1_0\vendors\etc\solaris\jdk1.5.0_05\bin\javac' is not recognized as an internal or external command,
          operable program or batch file.

          at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:516)
          at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
          at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
          at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
          ... 16 more
          [INFO] ------------------------------------------------------------------------
          [INFO] Total time: 2 seconds
          [INFO] Finished at: Thu Sep 11 15:15:57 BST 2008
          [INFO] Final Memory: 2M/9M
          [INFO] ------------------------------------------------------------------------

          Show
          Philip Schwarz added a comment - I am using Maven 2.0.9 and I have the problem even though there are no spaces in the path to the JDK : <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> <configuration> <verbose>true</verbose> <fork>true</fork> <source>1.5</source> <target>1.5</target> <compilerVersion>1.5</compilerVersion> <executable>C:/Views/KFL_1_0/vendors/etc/solaris/jdk1.5.0_05/bin/javac</executable> <meminitial>128m</meminitial> <maxmem>512m</maxmem> </configuration> </plugin> [ERROR] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Compilation failure Failure executing javac, but could not parse the error: 'C:\Views\KFL_1_0\vendors\etc\solaris\jdk1.5.0_05\bin\javac' is not recognized as an internal or external command, operable program or batch file. Failure executing javac, but could not parse the error: 'C:\Views\KFL_1_0\vendors\etc\solaris\jdk1.5.0_05\bin\javac' 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:\Views\KFL_1_0\vendors\etc\solaris\jdk1.5.0_05\bin\javac' 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:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) 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:\Views\KFL_1_0\vendors\etc\solaris\jdk1.5.0_05\bin\javac' is not recognized as an internal or external command, operable program or batch file. at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:516) at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558) ... 16 more [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2 seconds [INFO] Finished at: Thu Sep 11 15:15:57 BST 2008 [INFO] Final Memory: 2M/9M [INFO] ------------------------------------------------------------------------
          Hide
          Philip Schwarz added a comment -

          Apologies to everyone, the previous comment was a false alarm (loser error): I was asking Maven to run a solaris jdk on a Windows box!!!

          Show
          Philip Schwarz added a comment - Apologies to everyone, the previous comment was a false alarm (loser error): I was asking Maven to run a solaris jdk on a Windows box!!!
          Hide
          Dan Rollo added a comment -

          He he. But how cool would that have been if it had worked?!

          Show
          Dan Rollo added a comment - He he. But how cool would that have been if it had worked?!
          Brett Porter made changes -
          Fix Version/s 2.0.2 [ 12484 ]
          Hide
          Hilal Ram added a comment -

          I'm also 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 - I'm also 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
          Hilal Ram added a comment -

          HOW TO FIX THIS ISSUE
          ====================
          This is how you can Quick Fix this issue...

          Go to your compile plugin – Remove the <fork>true</fork> Element ; the build works fine.....

          <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <configuration>
          <!-- <fork>true</fork> -->
          <executable>
          $

          {JAVA_HOME_1.5}

          /bin/javac.exe
          </executable>
          <compilerVersion>1.5</compilerVersion>
          <source>1.5</source>
          <target>1.5</target>
          </configuration>
          </plugin>
          <plugin>

          Show
          Hilal Ram added a comment - HOW TO FIX THIS ISSUE ==================== This is how you can Quick Fix this issue... Go to your compile plugin – Remove the <fork>true</fork> Element ; the build works fine..... <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <!-- <fork>true</fork> --> <executable> $ {JAVA_HOME_1.5} /bin/javac.exe </executable> <compilerVersion>1.5</compilerVersion> <source>1.5</source> <target>1.5</target> </configuration> </plugin> <plugin>
          Hide
          Jakob Magiera added a comment - - edited

          @Hilal Ram
          This doesn't solve the issue, because maven is not actually executing the javac you specified but the internal compiler of the jdk that is set in your java_home. Think about it, it doesn't make sense to specify an executable if you are not going to fork a new process.

          Show
          Jakob Magiera added a comment - - edited @Hilal Ram This doesn't solve the issue, because maven is not actually executing the javac you specified but the internal compiler of the jdk that is set in your java_home. Think about it, it doesn't make sense to specify an executable if you are not going to fork a new process.
          Hide
          Hilal Ram added a comment -

          This is the solution for windws (and not unix) and fork tag has no significance.

          I think this is why it works Windws platforms : when you say fork = true, mvn thinks you are on unix and expect and executable path in Unix format..( I'm not sure of it, may be mvn experts can comment) and when you say fork=false (or comment it out to default to false) you are back in windws.

          Show
          Hilal Ram added a comment - This is the solution for windws (and not unix) and fork tag has no significance. I think this is why it works Windws platforms : when you say fork = true, mvn thinks you are on unix and expect and executable path in Unix format..( I'm not sure of it, may be mvn experts can comment) and when you say fork=false (or comment it out to default to false) you are back in windws.
          Hide
          Michael Osipov added a comment -

          Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014 if you're wondering why this issue was closed out.

          Show
          Michael Osipov added a comment - Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014 if you're wondering why this issue was closed out.
          Michael Osipov made changes -
          Status Reopened [ 4 ] Closed [ 6 ]
          Resolution Won't Fix [ 2 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 09:20:51 UTC 2015 [ 1428225651644 ]
          Mark Thomas made changes -
          Link This issue is related to SUREFIRE-77 [ SUREFIRE-77 ]
          Mark Thomas made changes -
          Workflow jira [ 12718548 ] Default workflow, editable Closed status [ 12749967 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 22:48:53 UTC 2015 [ 1428274133206 ]
          Mark Thomas made changes -
          Link This issue is related to SUREFIRE-77 [ SUREFIRE-77 ]
          Mark Thomas made changes -
          Workflow jira [ 12956164 ] Default workflow, editable Closed status [ 12993207 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Closed Closed
          9h 32m 1 Carlos Sanchez 03/Apr/06 19:36
          Closed Closed Reopened Reopened
          855d 13h 19m 2 Carlos Sanchez 06/Aug/08 14:58
          Reopened Reopened Closed Closed
          2302d 6h 52m 2 Michael Osipov 25/Nov/14 14:49

            People

            • Assignee:
              Unassigned
              Reporter:
              Carlos Sanchez
            • Votes:
              4 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development