01.pom.xml

一、Maven环境配置安装

二、Maven项目生成

mvn archetype:generate -DgroupId=com.mark.spark -DartifactId=spark-project -DarchetypeArtifactId=maven-archetype-quickstart  -DinteractiveMode=false

三、修改pom文件依赖

<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>com.mark.spark</groupId>
  <artifactId>spark-project</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>simple-project</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency> <!-- Spark dependency -->
      <groupId>org.apache.spark</groupId>
      <artifactId>spark-sql_2.11</artifactId>
      <version>2.2.0</version>
    </dependency>
  </dependencies> 
  <build>  
    <plugins>  
        <plugin>  
            <groupId>org.apache.maven.plugins</groupId>  
            <artifactId>maven-compiler-plugin</artifactId>  
            <version>3.1</version>  
            <configuration>  
                <source>1.8</source>  
                <target>1.8</target>  
            </configuration>  
        </plugin> 
        <plugin>   
            <artifactId>maven-dependency-plugin</artifactId>   
                <executions>   
                <execution>   
                    <phase>install</phase>   
                    <goals>   
                        <goal>copy-dependencies</goal>   
                    </goals>   
                    <configuration>   
                        <outputDirectory>${project.build.directory}/lib</outputDirectory>   
                    </configuration>   
                </execution>   
            </executions>   
        </plugin>  
    </plugins>  
   </build>  
</project>

四、编译打包生成jar文件

mvn clean install
mvn compile
mcn package
posted @ 2017-07-26 19:14  桃源仙居  阅读(73)  评论(0)    收藏  举报