2015-09-25 110 views

回答

0

這裏是Maven的POM我用,希望它能幫助:

<?xml version="1.0" encoding="UTF-8"?> 
<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/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 

<groupId>groupId</groupId> 
<artifactId>XXXXXX</artifactId> 
<version>0.0.1-SNAPSHOT</version> 

<properties> 
    <maven.compiler.source>1.7</maven.compiler.source> 
    <maven.compiler.target>1.7</maven.compiler.target> 
    <encoding>UTF-8</encoding> 
    <scala.version>2.10.4</scala.version> 
</properties> 

<dependencies> 
    <dependency> 
     <groupId>org.apache.spark</groupId> 
     <artifactId>spark-core_2.10</artifactId> 
     <version>1.3.1</version> 
    </dependency> 
    <dependency> 
     <groupId>com.esotericsoftware.kryo</groupId> 
     <artifactId>kryo</artifactId> 
     <version>2.24.0</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.spark</groupId> 
     <artifactId>spark-sql_2.10</artifactId> 
     <version>1.3.1</version> 
    </dependency> 
    <dependency> 
     <groupId>org.scala-lang</groupId> 
     <artifactId>scala-library</artifactId> 
     <version>${scala.version}</version> 
    </dependency> 
</dependencies> 

<build> 
    <pluginManagement> 
     <plugins> 
      <plugin> 
       <groupId>net.alchim31.maven</groupId> 
       <artifactId>scala-maven-plugin</artifactId> 
       <version>3.1.5</version> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-jar-plugin</artifactId> 
       <version>2.4</version> 
       <configuration> 
       <archive> 
        <manifest> 
         <mainClass>com.XXXXXXX</mainClass> 
        </manifest> 
       </archive> 
      </configuration> 
      </plugin> 
     </plugins> 
    </pluginManagement> 

    <plugins> 
     <plugin> 
      <groupId>net.alchim31.maven</groupId> 
      <artifactId>scala-maven-plugin</artifactId> 
      <executions> 
       <execution> 
        <id>scala-compile-first</id> 
        <phase>process-resources</phase> 
        <goals> 
         <goal>add-source</goal> 
         <goal>compile</goal> 
        </goals> 
       </execution> 
       <execution> 
        <id>scala-test-compile</id> 
        <phase>process-test-resources</phase> 
        <goals> 
         <goal>testCompile</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build>