3

我知道这个问题经常被问到,但那里的解决方案似乎是针对旧版本的 Maven。

我正在运行的版本:

hduser@lightning252:~/spark-0.7.0-2/examples/ex2$ mvn -version
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.6.0_26, vendor: Sun Microsystems Inc.
Java home: /usr/lib/jvm/java-6-sun-1.6.0.26/jre
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux", version: "3.2.0-4-amd64", arch: "amd64", family: "unix"

我正在使用的 pom.xml:

<project>
  <groupId>edu.berkeley</groupId>
  <artifactId>simple-project</artifactId>
  <modelVersion>4.0.0</modelVersion>
  <name>Simple Project</name>
  <packaging>jar</packaging>
  <version>1.0</version>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>2.3.2</version>
       <configuration>
        <source>1.5</source>
        <target>1.5</target>
       </configuration>
    </plugin>
  </plugins>
  <repositories>
    <repository>
      <id>Spray.cc repository</id>
      <url>http://repo.spray.cc</url>
    </repository>
    <repository>
      <id>Akka repository</id>
      <url>http://repo.akka.io/releases</url>
    </repository>
  </repositories>
  <dependencies>
    <dependency> <!-- Spark dependency -->
      <groupId>org.spark-project</groupId>
      <artifactId>spark-core_2.9.2</artifactId>
      <version>0.7.0</version>
    </dependency>
  </dependencies>
</project>

实际上我以前从未使用过 Maven,我正在尝试按照 Spark 项目给出的说明来编译 Spark 任务。pom.xml 直接取自:

http://spark-project.org/docs/latest/quick-start.html

我知道问题出在<plugins>有人可以让我知道如何解决吗?

4

1 回答 1

3

看了一圈,发现<plugins>标签需要被<build>标签包围。

我改变了,现在工作正常。请参阅下面的正确版本。

<project>
  <groupId>edu.berkeley</groupId>
  <artifactId>simple-project</artifactId>
  <modelVersion>4.0.0</modelVersion>
  <name>Simple Project</name>
  <packaging>jar</packaging>
  <version>1.0</version>
<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>2.3.2</version>
       <configuration>
        <source>1.5</source>
        <target>1.5</target>
       </configuration>
    </plugin>
  </plugins>
</build>
  <repositories>
    <repository>
      <id>Spray.cc repository</id>
      <url>http://repo.spray.cc</url>
    </repository>
    <repository>
      <id>Akka repository</id>
      <url>http://repo.akka.io/releases</url>
    </repository>
  </repositories>
  <dependencies>
    <dependency> <!-- Spark dependency -->
      <groupId>org.spark-project</groupId>
      <artifactId>spark-core_2.9.2</artifactId>
      <version>0.7.0</version>
    </dependency>
  </dependencies>
</project>
于 2013-03-25T00:00:06.113 回答