码迷,mamicode.com
首页 > 其他好文 > 详细

maven打包步骤

时间:2015-08-14 21:07:34      阅读:143      评论:0      收藏:0      [点我收藏+]

标签:

maven打包
1:先在pom文件中添加下面配置
<build>
        <plugins>
            <!-- compiler插件, 设定JDK版本 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                    <source>1.7</source>
                    <target>1.7</target>
                    <showWarnings>true</showWarnings>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass>cn.com.redis.App</mainClass>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

2:在cmd中窗口中切换到项目根目录,执行下面命令
    mvn clean  package -DskipTests


3:在项目根目录下的target目录下会有两个jar包,使用这个jar包启动:xxxxxxx-jar-with-dependencies.jar


4:执行  java -jar xxxx.jar

maven打包步骤

标签:

原文地址:http://www.cnblogs.com/chaoren399/p/4731006.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!