繁体   English   中英

Maven:尝试“ MVN软件包”时,Apache Spark错误

[英]Maven : Apache Spark error when trying to “mvn package”

我已通过下载zip并将其解压缩到本地存储库中,在本地安装了spark 1.3.1,以便将其放在此处home / my-user-name / spark-1.3.1中。
接下来的事情是我想使用Java,为了使其正常工作,我通过以下命令安装了maven:

$ sudo apt-get install maven

然后我使用以下命令检查版本:

mvn -version

这给了我这个:

Maven home: /usr/share/maven
Java version: 1.7.0_80, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.16.0-38-generic", arch: "amd64", family: "unix"

接下来,我想使用Maven从当前的存储库Documents /创建一个Java项目:

mvn archetype:generate -DgroupId=projet -DartifactId=Indexing -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

这意味着我的pom.xml文件位于存储库Documents / projet / Indexing /中,这就是我在pom.xml中获得的内容:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>mif37.projet</groupId>
  <artifactId>Indexing</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>IndexingMapReduce</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>

之后,我在标记依赖项中包含了一个更多的spark依赖项,因此我认为这是pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>mif37.projet</groupId>
  <artifactId>Indexing</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>IndexingMapReduce</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>org.apache.spark</groupId>
      <artifactId>spark-core_2.10</artifactId>
      <version>1.3.1</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>

然后从存储库pom.xml运行命令行:

mvn package

但是最后,这就是我得到的:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9:18.021s
[INFO] Finished at: Sun May 31 20:49:52 CEST 2015
[INFO] Final Memory: 12M/137M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project Indexing: Could not resolve dependencies for project projet:Indexing:jar:1.0-SNAPSHOT: Could not transfer artifact org.apache.spark:spark-core_2.10:jar:1.3.1 from/to central (http://repo.maven.apache.org/maven2): GET request of: org/apache/spark/spark-core_2.10/1.3.1/spark-core_2.10-1.3.1.jar from central failed: Connection reset -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

任何人都可以指出我在哪里做错了? 谢谢。

您的pom.xml和过程很好。 存在防火墙/连接问题-如以下所述:

.spark:spark-core_2.10:jar:1.3.1 from/to central (http://repo.maven.apache.org/maven2): GET request of: org/apache/spark/spark-core_2.10/1.3.1/spark-core_2.10-1.3.1.jar from central failed: Connection reset -> [Help 1]
[ERROR] 

您可以通过在“开放”环境中(例如在家而不是在工作场所)重复执行步骤来验证自己。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM