码迷,mamicode.com
首页 > 编程语言 > 详细

maven启动jar

时间:2016-01-22 03:27:02      阅读:310      评论:0      收藏:0      [点我收藏+]

标签:maven打jar

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<!--打入jar包的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.DontIncludeResourceTransformer">
<resource>META-INF/ECLIPSEF.SF</resource>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
 <mainClass>com.zeus.plug.HttpServerMain</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin> -->
<!-- 把依赖jar打另外文件夹 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>copy-lib</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<excludeScope>test</excludeScope>
<excludeScope>provided</excludeScope>
<outputDirectory>${basedir}/target/lib</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-modules</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${basedir}/target/lib</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>





启动依赖jar的java jar包

java -cp ./lib;zeus-plug-0.0.1-SNAPSHOT.jar com.zeus.plug.HttpServerMain

java -Dport=8089 -cp ./lib;zeus-plug-0.0.1-SNAPSHOT.jar com.zeus.plug.HttpServerMain

---启动jar

java -jar ****.jar

---指定端口启动jar

java -jar -Dport=8089 *****.jar


maven启动jar

标签:maven打jar

原文地址:http://xuanxy.blog.51cto.com/2357481/1737384

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