我知道时间戳是因为我使用SNAPSHOTs并且有其原因。 maven生成的MANIFEST文件是:
Manifest-Version: 1.0
Built-By: educi
Build-Jdk: 1.7.0_80
Class-Path: guice-servlet-2.0.jar reflections-0.9.10.jar javassist-3.1
9.0-GA.jar annotations-2.0.1.jar httpclient-4.5.3.jar httpcore-4.4.6.
jar commons-logging-1.2.jar jungle-server-core-3.6.9.alpha-SNAPSHOT.j
ar slf4j-api-1.7.12.jar jungle-api-3.6.9.alpha-SNAPSHOT.jar jetty-cli
ent-7.0.2.v20100331.jar jetty-http-7.0.2.v20100331.jar jetty-io-7.0.2
.v20100331.jar jetty-util-7.0.2.v20100331.jar jungle-nativex-ptcmlb-6
4.0.0.7-SNAPSHOT.jar jungle-nativex-wzmq-64.0.0.6-20140620.082549-4.j
ar netty-all-4.0.45.Final.jar wup-1.1.0.jar protobuf-java-2.6.1.jar c
ommons-codec-1.4.jar kilim-1.0.5.jar datacollector-1.8.1.jar TDBusSDK
-0.0.7.jar netty-3.8.0.Final.jar snappy-java-1.1.0.jar fastjson-1.2.3
8.jar jungle-nativex-uls-64.0.0.14-SNAPSHOT.jar jungle-nativex-tmem-a
sync-64.0.0.10-SNAPSHOT.jar jungle-nativex-secapi-0.0.2-64-20140107.0
95450-4.jar jungle-nativex-l5-0.0.2-64-20140107.095453-6.jar jackson-
core-asl-1.9.4.jar jackson-mapper-asl-1.9.4.jar jungle-jniloader-0.0.
1-SNAPSHOT.jar guava-20.0.jar jungle-core-3.5.8.alpha-SNAPSHOT.jar di
sruptor-3.3.4.jar log4j-api-2.3.jar log4j-core-2.3.jar log4j-slf4j-im
pl-2.3.jar aopalliance-1.0.jar commons-io-1.4.jar commons-pool-1.6.ja
r commons-configuration-1.6.jar commons-collections-3.2.1.jar commons
-lang-2.4.jar commons-digester-1.8.jar commons-beanutils-1.7.0.jar co
mmons-beanutils-core-1.8.0.jar asm-all-4.1.jar zookeeper-3.4.5.jar ne
tty-3.2.2.Final.jar javax.servlet-api-3.0.1.jar xmemcached-1.3.5.jar
jungle-nativex-xoilib-64.0.0.7-20160506.092827-1.jar curator-framewor
k-2.1.0-incubating.jar curator-client-2.1.0-incubating.jar joda-time-
2.9.7.jar jungle-nativex-msgq-64.0.0.6-SNAPSHOT.jar jungle-nativex-oi
cq-0.0.3-20160525.091252-1.jar edu-info-read-pb-1.0.0-SNAPSHOT.jar me
ssage-sys-pb-1.0.0-SNAPSHOT.jar junit-4.11.jar hamcrest-core-1.3.jar
rpc-proxy-4.0.5-SNAPSHOT.jar jedis-2.9.0.jar commons-pool2-2.4.2.jar
jungle-nativex-cmlb-64.0.0.1-20140820.093005-4.jar slf4j-log4j12-1.5.
11.jar log4j-1.2.14.jar edu-timer-1.1.0-SNAPSHOT.jar quartz-2.2.2.jar
c3p0-0.9.1.1.jar timer-pb-1.0.0-20171117.013525-14.jar jungle-db-0.1
.3-20160403.101241-1.jar mysql-connector-java-5.1.31.jar mybatis-3.3.
0.jar mybatis-guice-3.7.jar guice-4.0.jar javax.inject-1.jar gson-2.3
.1.jar HikariCP-java6-2.3.9.jar jsqlparser-0.9.3.jar
Created-By: Apache Maven 3.2.5
Main-Class: com.tencent.eduChat.Bootstrap
但是mvn rar:rar生成的jar文件不会出现这些时间戳。
我的问题是为什么实际的jar文件名与MANIFEST.MF描述不同。
我认为这就是为什么我无法使用-jar $path/lib/${MY_JAR_NAME}
启动我的项目,这种方式有效-cp .:${path}/lib/* ${MAIN_CLASS}
,但jar
方式更好,因为包括MANIFEST.MF中描述了MAIN_CLASS。另一个解决方案是使用<userUniqueVersions>false<useUniqueVersions>
配置强制maven摆脱时间戳。但我认为时间戳是有原因的,解决它不是一个好主意。
`http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0
<parent>
<groupId>com.tencent.jungle</groupId>
<artifactId>jungle-parent</artifactId>
<version>3.6.7.alpha-SNAPSHOT</version>
</parent>
<artifactId>javasvr_edu_chat</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>javasvr_edu_user_center</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kilim.weave.required>true</kilim.weave.required>
<maven.test.skip>true</maven.test.skip>
</properties>
<dependencies>
<dependency>
<groupId>com.tencent.jungle.tools</groupId>
<artifactId>jungle-panther</artifactId>
<version>4.0.1-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.tencent.jungle</groupId>
<artifactId>jungle-server-core</artifactId>
<version>3.6.9.alpha-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.tencent.jungle.nativex</groupId>
<artifactId>jungle-nativex-tmem-async</artifactId>
<version>64.0.0.10-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>com.tencent.jungle.nativex</groupId>
<artifactId>jungle-nativex-xoilib</artifactId>
</exclusion>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>20.0</version>
</dependency>
<dependency>
<groupId>com.tencent.jungle</groupId>
<artifactId>jungle-core</artifactId>
<version>3.5.8.alpha-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-log4j12</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>guice</artifactId>
<groupId>com.google.inject</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.7</version>
</dependency>
<dependency>
<groupId>com.tencent.jungle.nativex</groupId>
<artifactId>jungle-nativex-msgq</artifactId>
<version>64.0.0.6-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.tencent.jungle.nativex</groupId>
<artifactId>jungle-nativex-oicq</artifactId>
<version>0.0.3-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.tencent.edu.pb</groupId>
<artifactId>edu-info-read-pb</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.tencent.edu.pb</groupId>
<artifactId>message-sys-pb</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>com.tencent.jungle</groupId>
<artifactId>rpc-proxy</artifactId>
<version>4.0.5-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>com.tencent.jungle</groupId>
<artifactId>jungle-server-core</artifactId>
</exclusion>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.tencent.edu.timer</groupId>
<artifactId>edu-timer</artifactId>
<version>1.1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.tencent.jungle</groupId>
<artifactId>jungle-db</artifactId>
<version>0.1.3-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-log4j12</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<mainClass>com.tencent.eduChat.Bootstrap</mainClass>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/lib
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
` 这是我的pom.xml。 tks:)