<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>zhch.illq.time</groupId>
<artifactId>time_tool</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>time_tool</name>
<url>http://maven.apache.org</url>
<!-- 指定属性 -->
<properties>
<cxf.version>2.2.8</cxf.version>
<spring.version>3.0.2.RELEASE</spring.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>zhch.illq.time.TimeTool</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
jar 命令:
假设现在是在classes目录的同级目录中
jar cvef zhch.illq.time.TimeTool timetool.jar -C classes .
-C 是指定要打包的目录
. (点) 是文件,表示当前目录,这样就把classes目录中及子目录中所有文件打包
参数e f 分别指定main class和生成的jar文件名, 后面要按顺序来
也可以写成这样
jar cvfe timetool.jar zhch.illq.time.TimeTool -C classes .