首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

maven 三 jar 运行文件打包

2012-09-14 
maven 3 jar 运行文件打包@author?刘庆@version 1.0?1. maven 主要文件pom.xml 这就不用多说了?因为我们要

maven 3 jar 运行文件打包

@author?刘庆

@version 1.0

?

1. maven 主要文件pom.xml 这就不用多说了

?

因为我们要打包*.jar 运行文件

?

?

<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>com.helloworld</groupId>    <artifactId>usbHelloworld</artifactId>    <version>1.0-SNAPSHOT</version>    <packaging>jar</packaging>    <name>usb</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>4.7</version>            <scope>test</scope>        </dependency>    </dependencies><build>    <plugins>    <plugin>        <groupId>org.apache.maven.plugins</groupId>    <!--加入对应的插件内容-->        <artifactId>maven-shade-plugin</artifactId><configuration><source>1.6</source><target>1.6</target></configuration><executions>    <execution>    <phase>package</phase><goals>    <goal>shade</goal></goals><configuration>    <transformers>    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">    <mainClass>com.helloworld.HelloWorld</mainClass></transformer></transformers></configuration></execution></executions></plugin></plugins></build></project>

?

?

?

?

E:\mavenTest\workspace\helloWorld>mvn clean install[INFO] Scanning for projects...[WARNING][WARNING] Some problems were encountered while building the ecom.helloworld:usbHelloworld:jar:1.0-SNAPSHOT[WARNING] 'build.plugins.plugin.version' for org.apache.mavene-plugin is missing. @ line 28, column 15[WARNING][WARNING] It is highly recommended to fix these problems becahe stability of your build.[WARNING]

?

?

[INFO] Installing E:\mavenTest\workspace\helloWorld\target\PSHOT.jar to C:\Documents and Settings\Administrator\.m2\reld\usbHelloworld\1.0-SNAPSHOT\usbHelloworld-1.0-SNAPSHOT.ja[INFO] Installing E:\mavenTest\workspace\helloWorld\pom.xmlSettings\Administrator\.m2\repository\com\helloworld\usbHelusbHelloworld-1.0-SNAPSHOT.pom[INFO] ----------------------------------------------------[INFO] BUILD SUCCESS[INFO] ----------------------------------------------------[INFO] Total time: 2.297s[INFO] Finished at: Mon Dec 26 22:54:45 CST 2011[INFO] Final Memory: 6M/16M[INFO] ----------------------------------------------------E:\mavenTest\workspace\helloWorld>
?

?

OK 运行成功

?

?

E:\mavenTest\workspace\helloWorld\target>java -jar usbHelloworld-1.0-SNAPSHOT-shaded.jarHello World!

?

文件路径

?

projectName \src\main\java\com\zk\HelloWorld.java

? ? ? ? ? ? ? ? ? ? \pom.xml

?

maven 三 jar 运行文件打包

?

?

META-INF/MANIFEST.MF 文件内容

?

?

Manifest-Version: 1.0Build-Jdk: 1.6.0_29Built-By: liuqingCreated-By: Apache MavenMain-Class: com.helloworld.HelloWorldArchiver-Version: Plexus Archiver
?

?

?

?

?

?

?

?

?

?

?

?

热点排行