欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

maven pom.xml 配置初探

程序员文章站 2022-06-19 08:14:35
...
<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>BaiduMobileMap</groupId>
    <artifactId>Stats</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>Stats</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>

                <!-- 本地jar 文件包 -->
        <dependency>
            <groupId>org.apache</groupId>
            <artifactId>hadoop-core</artifactId>
            <version>1.0</version>
            <scope>system</scope>
            <systemPath>/Users/baidu/workspace/Stats/lib/hadoop-core-1.1.3.2.jar</systemPath>
        </dependency>

        <dependency>
            <groupId>org.apache</groupId>
            <artifactId>hive-exec</artifactId>
            <version>1.0</version>
            <scope>system</scope>
            <systemPath>/Users/baidu/workspace/Stats/lib/hive-exec-2.3.38.jar</systemPath>
        </dependency>
    </dependencies>

    <build>
        <plugins>
                    <!-- jdk 使用1.6 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
                        <!-- 打成jar包 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>1.4</version>
                <configuration>
                    <createDependencyReducedPom>true</createDependencyReducedPom>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer
                                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                                                       <!-- 主类 -->
                                    <mainClass>BaiduMobileMap.HelloHiveUDF</mainClass>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>


</project>


本文转自 拖鞋崽 51CTO博客,原文链接:
http://blog.51cto.com/1992mrwang/2046201