【问题标题】:Building Spark with Maven: error finding javac (but path is correct)使用 Maven 构建 Spark:查找 javac 时出错(但路径正确)
【发布时间】:2016-03-09 10:48:14
【问题描述】:

我正在尝试在 Windows 上构建 Spark 1.5.0 快照。首先,我使用 Cygwin 运行make-distribution.sh(它拉动了 Maven 等)。现在我在跑步

mvn -DskipTests clean package

得到这个错误,提示找不到javac。

[INFO] --- scala-maven-plugin:3.2.2:compile (scala-compile-first) @ spark-launcher_2.10 ---
[INFO] Using zinc server for incremental compilation
←[0m[←[0minfo←[0m] ←[0mCompiling 8 Java sources to C:\spark-1.5.0-SNAPSHOT\launcher\target\scala-2.10\classes...←[0m
←[0m[←[31merror←[0m] ←[0mCannot run program "javac": CreateProcess error=2, The system cannot find the file specified←[0m

这个提问者How to build Spark 1.2 with Maven (gives java.io.IOException: Cannot run program "javac")? 有一个类似的问题 - 它是通过修复环境变量来解决的。我觉得我的还可以:

> where javac
C:\Program Files\Java\jdk1.8.0_45\bin\javac.exe

> javac -help
Usage: javac <options> <source files>
where possible options include:
...

> where mvn
C:\spark-1.5.0-SNAPSHOT\build\apache-maven-3.3.3\bin\mvn
C:\spark-1.5.0-SNAPSHOT\build\apache-maven-3.3.3\bin\mvn.cmd

> echo %JAVA_HOME%
C:\PROGRA~1\Java\jdk1.8.0_45

> mvn -v
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T21:57:37+10:00)
Maven home: C:\spark-1.5.0-SNAPSHOT\build\apache-maven-3.3.3\bin\..
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: C:\PROGRA~1\Java\jdk1.8.0_45\jre
Default locale: en_AU, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"

接下来我应该尝试什么?


C:\spark-1.5.0-SNAPSHOT>mvn -DskipTests clean package
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Spark Project Parent POM
[INFO] Spark Project Launcher
..
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Spark Project Parent POM 1.5.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) @ spark-parent_2.10 ---
[INFO] Deleting C:\spark-1.5.0-SNAPSHOT\target
[INFO]
[INFO] --- maven-enforcer-plugin:1.4:enforce (enforce-versions) @ spark-parent_2.10 ---
[INFO]
[INFO] --- scala-maven-plugin:3.2.2:add-source (eclipse-add-source) @ spark-parent_2.10 ---
[INFO] Add Source directory: C:\spark-1.5.0-SNAPSHOT\src\main\scala
[INFO] Add Test Source directory: C:\spark-1.5.0-SNAPSHOT\src\test\scala
[INFO]
[INFO] --- maven-remote-resources-plugin:1.5:process (default) @ spark-parent_2.10 ---
[INFO]
[INFO] --- scala-maven-plugin:3.2.2:compile (scala-compile-first) @ spark-parent_2.10 ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-antrun-plugin:1.8:run (create-tmp-dir) @ spark-parent_2.10 ---
[INFO] Executing tasks

main:
    [mkdir] Created dir: C:\spark-1.5.0-SNAPSHOT\target\tmp
[INFO] Executed tasks
[INFO]
[INFO] --- scala-maven-plugin:3.2.2:testCompile (scala-test-compile-first) @ spark-parent_2.10 ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-dependency-plugin:2.10:build-classpath (default) @ spark-parent_2.10 ---
[INFO]
[INFO] --- scalatest-maven-plugin:1.0:test (test) @ spark-parent_2.10 ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.6:test-jar (prepare-test-jar) @ spark-parent_2.10 ---
[INFO] Building jar: C:\spark-1.5.0-SNAPSHOT\target\spark-parent_2.10-1.5.0-SNAPSHOT-tests.jar
[INFO]
[INFO] --- maven-site-plugin:3.3:attach-descriptor (attach-descriptor) @ spark-parent_2.10 ---
[INFO]
[INFO] --- maven-shade-plugin:2.4.1:shade (default) @ spark-parent_2.10 ---
[INFO] Including org.spark-project.spark:unused:jar:1.0.0 in the shaded jar.
[INFO] Replacing original artifact with shaded artifact.
[INFO]
[INFO] --- maven-source-plugin:2.4:jar-no-fork (create-source-jar) @ spark-parent_2.10 ---
[INFO]
[INFO] --- maven-source-plugin:2.4:test-jar-no-fork (create-source-jar) @ spark-parent_2.10 ---
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Spark Project Launcher 1.5.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) @ spark-launcher_2.10 ---
[INFO] Deleting C:\spark-1.5.0-SNAPSHOT\launcher\target
[INFO]
[INFO] --- maven-enforcer-plugin:1.4:enforce (enforce-versions) @ spark-launcher_2.10 ---
[INFO]
[INFO] --- scala-maven-plugin:3.2.2:add-source (eclipse-add-source) @ spark-launcher_2.10 ---
[INFO] Add Source directory: C:\spark-1.5.0-SNAPSHOT\launcher\src\main\scala
[INFO] Add Test Source directory: C:\spark-1.5.0-SNAPSHOT\launcher\src\test\scala
[INFO]
[INFO] --- maven-remote-resources-plugin:1.5:process (default) @ spark-launcher_2.10 ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ spark-launcher_2.10 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\spark-1.5.0-SNAPSHOT\launcher\src\main\resources
[INFO] Copying 3 resources
[INFO]
[INFO] --- scala-maven-plugin:3.2.2:compile (scala-compile-first) @ spark-launcher_2.10 ---
[INFO] Using zinc server for incremental compilation
←[0m[←[0minfo←[0m] ←[0mCompiling 8 Java sources to C:\spark-1.5.0-SNAPSHOT\launcher\target\scala-2.10\classes...←[0m
←[0m[←[31merror←[0m] ←[0mCannot run program "javac": CreateProcess error=2, The system cannot find the file specified←[0m
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Spark Project Parent POM ........................... SUCCESS [  3.158 s]
[INFO] Spark Project Launcher ............................. FAILURE [  2.930 s]
[INFO] Spark Project Networking ........................... SKIPPED
[INFO] Spark Project Shuffle Streaming Service ............ SKIPPED
..
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.2.2:compile (scala-compile-first) on project spark-launcher_2.10: Execution scala-compile-first of goal net.alchim31.maven:scala-maven-plugin:3.2.2:compile failed. CompileFailed -> [Help 1]

【问题讨论】:

  • javac 在您的PATH 上吗?即,javac -help 有效吗?
  • @DeanWampler 谢谢,是的(已编辑问题)
  • 能否显示 mvn -v 的输出?
  • 可能是因为你的JDK安装在包含空格的路径中。我从不将我的 JDK 安装到 Program Files
  • @heenenee :( 我想我可以在其他地方尝试一个新的 JDK。注意 PATH 正在使用 C:\PROGRA~1。它是 where 命令正在扩展它。

标签: java maven apache-spark


【解决方案1】:

首先关闭锌应该可以解决您的问题。参见文档here

./build/zinc-<version>/bin/zinc -shutdown

【讨论】:

    【解决方案2】:

    另一种方法是更改​​spark的pom.xml并注释该行

    <!--<useZincServer>true</useZincServer>-->
    

    【讨论】:

      猜你喜欢
      • 2015-06-09
      • 1970-01-01
      • 1970-01-01
      • 2018-04-28
      • 2018-12-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多