• hadoop-maven项目打包成可执行的jar


    环境:

    cdh5.1.0

    jdk1.7

    	<build>
    		<plugins>
    		<!--指定JDK为1.7 -->
    			<plugin>
    				<groupId>org.apache.maven.plugins</groupId>
    				<artifactId>maven-compiler-plugin</artifactId>
    				<configuration>
    					<source>1.7</source>
    					<target>1.7</target>
    				</configuration>
    			</plugin>
    			<!--指定主函数和各个依赖-->
    			<plugin>
    				<artifactId>maven-assembly-plugin</artifactId>
    				<version>2.2</version>
    				<configuration>
    					<archive>
    						<manifest>
    							<mainClass>com.gsta.bdi.dh.mr.MainJob</mainClass>
    						</manifest>
    					</archive>
    					<descriptorRefs>
    						<descriptorRef>jar-with-dependencies</descriptorRef>
    					</descriptorRefs>
    				</configuration>
    				<executions>
    					<execution>
    						<id>make-assembly</id>
    						<phase>package</phase>
    						<goals>
    							<goal>single</goal>
    						</goals>
    					</execution>
    				</executions>
    			</plugin>
    		</plugins>
    		<!--加入配置文件-->
    		<resources>
    			<resource>
    				<directory>src/main/java</directory>
    				<includes>
    					<include>**/*.properties</include>
    				</includes>
    			</resource>
    			<resource>
    				<directory>src/main/resources</directory>
    			</resource>
    			<resource>
    				<directory>resources</directory>
    			</resource>
    		</resources>
    	</build>



    整个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/xsd/maven-4.0.0.xsd">
    	<modelVersion>4.0.0</modelVersion>
    
    	<groupId>TEST<span style="font-family: Arial, Helvetica, sans-serif;"></groupId></span>
    	<artifactId>mytest</artifactId>
    	<version>0.0.1-SNAPSHOT</version>
    	<packaging>jar</packaging>
    
    	<name>taglib-customer</name>
    	<url>http://maven.apache.org</url>
    	<repositories>
    		<repository>
    			<id>cloudera</id>
    			<url>https://repository.cloudera.com/artifactory/cloudera-repos/</url>
    		</repository>
    		<repository>
    			<id>cloudera2</id>
    			<url>https://repository.cloudera.com/content/groups/public</url>
    		</repository>
    	</repositories>
    	<properties>
    		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    	</properties>
    
    	<dependencies>
    		<dependency>
    			<groupId>jdk.tools</groupId>
    			<artifactId>jdk.tools</artifactId>
    			<version>jdk1.7.0_45</version>
    			<scope>system</scope>
    			<systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
    		</dependency>
    		<dependency>
    			<groupId>junit</groupId>
    			<artifactId>junit</artifactId>
    			<version>3.8.1</version>
    			<scope>test</scope>
    		</dependency>
    		
    		<!--hadoop-2.3.0-cdh5.1.0 -->
    
    		<dependency>
    			<groupId>org.apache.hadoop</groupId>
    			<artifactId>hadoop-core</artifactId>
    			<version>2.3.0-mr1-cdh5.1.0</version>
    		</dependency>
    
    		<dependency>
    			<groupId>org.apache.hadoop</groupId>
    			<artifactId>hadoop-client</artifactId>
    			<version>2.3.0-mr1-cdh5.1.0</version>
    		</dependency>
    		<dependency>
    			<groupId>org.apache.hadoop</groupId>
    			<artifactId>hadoop-mapreduce-client-core</artifactId>
    			<version>2.3.0-cdh5.1.0</version>
    		</dependency>
    		<dependency>
    			<groupId>org.apache.hadoop</groupId>
    			<artifactId>hadoop-annotations</artifactId>
    			<version>2.3.0-cdh5.1.0</version>
    		</dependency>
    		<dependency>
    			<groupId>org.apache.hadoop</groupId>
    			<artifactId>hadoop-auth</artifactId>
    			<version>2.3.0-cdh5.1.0</version>
    		</dependency>
    		<dependency>
    			<groupId>org.apache.hadoop</groupId>
    			<artifactId>hadoop-hdfs</artifactId>
    			<version>2.3.0-cdh5.1.0</version>
    		</dependency>
    
    
    		<!--hive-2.3.0-cdh5.1.0 -->
    		<dependency>
    			<groupId>org.apache.hive</groupId>
    			<artifactId>hive-jdbc</artifactId>
    			<version>0.12.0-cdh5.1.0</version>
    		</dependency>
    		<dependency>
    			<groupId>org.apache.hadoop</groupId>
    			<artifactId>hadoop-common</artifactId>
    			<version>2.3.0-cdh5.1.0</version>
    		</dependency>
    
    
    		<!--hbase -2.3.0-cdh5.1.0 -->
    		<dependency>
    			<groupId>org.apache.hbase</groupId>
    			<artifactId>hbase-client</artifactId>
    			<version>0.98.1-cdh5.1.0</version>
    		</dependency>
    		<dependency>
    			<groupId>org.apache.hbase</groupId>
    			<artifactId>hbase-common</artifactId>
    			<version>0.98.1-cdh5.1.0</version>
    		</dependency>
    		<dependency>
    			<groupId>org.apache.hbase</groupId>
    			<artifactId>hbase-hadoop-compat</artifactId>
    			<version>0.98.1-cdh5.1.0</version>
    		</dependency>
    		<dependency>
    			<groupId>org.apache.hbase</groupId>
    			<artifactId>hbase-hadoop2-compat</artifactId>
    			<version>0.98.1-cdh5.1.0</version>
    		</dependency>
    		<dependency>
    			<groupId>org.apache.hbase</groupId>
    			<artifactId>hbase-it</artifactId>
    			<version>0.98.1-cdh5.1.0</version>
    		</dependency>
    	</dependencies>
    	<build>
    		<plugins>
    		<!--指定JDK为1.7 -->
    			<plugin>
    				<groupId>org.apache.maven.plugins</groupId>
    				<artifactId>maven-compiler-plugin</artifactId>
    				<configuration>
    					<source>1.7</source>
    					<target>1.7</target>
    				</configuration>
    			</plugin>
    			<!--指定主函数和各个依赖-->
    			<plugin>
    				<artifactId>maven-assembly-plugin</artifactId>
    				<version>2.2</version>
    				<configuration>
    					<archive>
    						<manifest>
    							<mainClass>com.gsta.bdi.dh.mr.MainJob</mainClass>
    						</manifest>
    					</archive>
    					<descriptorRefs>
    						<descriptorRef>jar-with-dependencies</descriptorRef>
    					</descriptorRefs>
    				</configuration>
    				<executions>
    					<execution>
    						<id>make-assembly</id>
    						<phase>package</phase>
    						<goals>
    							<goal>single</goal>
    						</goals>
    					</execution>
    				</executions>
    			</plugin>
    		</plugins>
    		<!--加入配置文件-->
    		<resources>
    			<resource>
    				<directory>src/main/java</directory>
    				<includes>
    					<include>**/*.properties</include>
    				</includes>
    			</resource>
    			<resource>
    				<directory>src/main/resources</directory>
    			</resource>
    			<resource>
    				<directory>resources</directory>
    			</resource>
    		</resources>
    	</build>
    </project>
    


    版权声明:本文为博主原创文章,未经博主允许不得转载。

  • 相关阅读:
    modelsim(2)
    【管理心得之十六】我来吐槽 “面试”
    【管理心得之十五】没有100%的答案,只有70%认可的答案
    【管理心得之十四】团队中的“短板”,是你?还是他?
    【管理心得之十三】真正步入轨道的管理,是单调无味的、是枯燥死板的
    【管理心得之十二】拿什么来拯救你我的“协力人员” (后篇)
    【管理心得之十一】拿什么来拯救你我的“协力人员” (前篇)
    【管理心得之十】你是信息的发送方,应尽的责任你做到了吗?
    【管理心得之九】奉劝那些把组织“玩弄于鼓掌之间”的OL们。(别让组织看见此篇)
    【管理心得之八】通过现象看本质,小王和小张谁更胜任?
  • 原文地址:https://www.cnblogs.com/jamesf/p/4751490.html
Copyright © 2020-2023  润新知