如何在 Windows 上构建 Livy 客户端?
How to build the Livy client on Windows?
我想在 Windows 上编写一个 Java 应用程序,它使用 Livy 的 Java API 与远程托管的 Apache Livy 服务器通信。 docs 说:
Add the Livy client dependency to your application's POM:
<dependency>
<groupId>org.apache.livy</groupId>
<artifactId>livy-client-http</artifactId>
<version>0.4.0-SNAPSHOT</version>
</dependency>
Note: Until Livy's first Apache release you will have to install the
livy artifacts locally using mvn install
不幸的是,它看起来像是在 Windows isn't supported 上构建 Livy。有人在 Windows 上成功构建了 Livy 客户端吗?
我所关心的只是让 livy-client-http 构建并安装在我的本地 maven .m2 存储库中。这就是我在 Windows 7:
中所做的
git clone
incubator-livy 然后在其 pom.xml
中注释掉此部分(归功于 Yatzhash):
<requireOS>
<family>unix</family>
</requireOS>
运行 mvn install -DskipTests
在顶级目录中。如果您从常规 Windows 命令提示符执行此操作,它最终将失败并显示此错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run (default) on project livy-server: An Ant BuildException has occured: Execute
failed: java.io.IOException: Cannot run program "bash" (in directory "C:\github.com\incubator-livy\server"): CreateProcess error=2, The system cannot find the
file specified
[ERROR] around Ant part ...... @ 4:27 in C:\github.com\incubator-livy\server\target\antrun\build-main.xml
但是,如果您 运行 在 Git Bash 提示符下执行相同的命令,则可以绕过此错误。最终构建将在 livy-integration-test 失败,但至少 livy-client-http 构建应该已经通过。
但您会发现此 jar 文件已安装在您的 .m2 存储库中:livy-client-http-0.4.0-incubating-SNAPSHOT.jar。这意味着您需要将自己的客户端应用程序的依赖项修改为如下所示,而不是 Livy 文档推荐的依赖项:
<dependency>
<groupId>org.apache.livy</groupId>
<artifactId>livy-client-http</artifactId>
<version>0.4.0-incubating-SNAPSHOT</version>
</dependency>
我还必须将此依赖项添加到我的客户端应用程序,因为我想通过 Livy 与 Spark 2.1 服务器通信:
<dependency>
<!-- See https://spark.apache.org/docs/2.1.0/programming-guide.html#linking-with-spark -->
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.1.0</version>
</dependency>
然后我的客户端应用程序将在 Windows 中编译。
我想在 Windows 上编写一个 Java 应用程序,它使用 Livy 的 Java API 与远程托管的 Apache Livy 服务器通信。 docs 说:
Add the Livy client dependency to your application's POM:
<dependency>
<groupId>org.apache.livy</groupId>
<artifactId>livy-client-http</artifactId>
<version>0.4.0-SNAPSHOT</version>
</dependency>
Note: Until Livy's first Apache release you will have to install the livy artifacts locally using
mvn install
不幸的是,它看起来像是在 Windows isn't supported 上构建 Livy。有人在 Windows 上成功构建了 Livy 客户端吗?
我所关心的只是让 livy-client-http 构建并安装在我的本地 maven .m2 存储库中。这就是我在 Windows 7:
中所做的git clone
incubator-livy 然后在其 pom.xml
中注释掉此部分(归功于 Yatzhash):
<requireOS>
<family>unix</family>
</requireOS>
运行 mvn install -DskipTests
在顶级目录中。如果您从常规 Windows 命令提示符执行此操作,它最终将失败并显示此错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run (default) on project livy-server: An Ant BuildException has occured: Execute failed: java.io.IOException: Cannot run program "bash" (in directory "C:\github.com\incubator-livy\server"): CreateProcess error=2, The system cannot find the file specified [ERROR] around Ant part ...... @ 4:27 in C:\github.com\incubator-livy\server\target\antrun\build-main.xml
但是,如果您 运行 在 Git Bash 提示符下执行相同的命令,则可以绕过此错误。最终构建将在 livy-integration-test 失败,但至少 livy-client-http 构建应该已经通过。
但您会发现此 jar 文件已安装在您的 .m2 存储库中:livy-client-http-0.4.0-incubating-SNAPSHOT.jar。这意味着您需要将自己的客户端应用程序的依赖项修改为如下所示,而不是 Livy 文档推荐的依赖项:
<dependency>
<groupId>org.apache.livy</groupId>
<artifactId>livy-client-http</artifactId>
<version>0.4.0-incubating-SNAPSHOT</version>
</dependency>
我还必须将此依赖项添加到我的客户端应用程序,因为我想通过 Livy 与 Spark 2.1 服务器通信:
<dependency>
<!-- See https://spark.apache.org/docs/2.1.0/programming-guide.html#linking-with-spark -->
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.1.0</version>
</dependency>
然后我的客户端应用程序将在 Windows 中编译。