我已经在本地安装了spark 1.3.1,方法是下载zip并将其解压缩到我的家庭存储库中,这样我就可以在这里将它/ 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"
然后接下来就是我想从当前存放的Documents /:
创建一个使用Maven的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
任何人都可以指出我做错的地方? 感谢。
答案 0 :(得分:0)
你的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]
您可以通过重复“开放”步骤来自行验证。环境 - 例如在你家里而不是工作。