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 Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.0.1
    • Fix Version/s: None
    • Labels:
      None
    • Number of attachments :
      0

      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

          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.

            People

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

              Dates

              • Created:
                Updated:
                Resolved: