我有这个代码来添加我的类路径:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addClasspath>true</addClasspath>
<mainClass>ApuestaYa</mainClass>
</manifest>
<manifestEntries>
<Class-path>../lib/jcalendar.jar ../lib/eclipselink.jar ../lib/libforms-1.3.0.jar ../lib/Imagenes.jar ../lib/DriverPersistencia.jar ../lib/javax.persistence_2.0.3.v201010191057.jar</Class-path>
</manifestEntries>
</archive>
</configuration>
</plugin>
但我在 manifest.mf 中得到了这个:
Manifest-Version: 1.0
Implementation-Title: Apuestaya
Implementation-Version: 0.9.0-SNAPSHOT
Implementation-Vendor-Id: um.tds.VictorMRuiz
Built-By: Celor
Build-Jdk: 1.7.0_09
Class-Path: ../lib/jcalendar.jar ../lib/eclipselink.jar ../lib/libform
s-1.3.0.jar ../lib/Imagenes.jar ../lib/DriverPersistencia.jar ../lib/
javax.persistence_2.0.3.v201010191057.jar
Created-By: Apache Maven 3.0.4
Main-Class: ApuestaYa
Archiver-Version: Plexus Archiver
如您所见,Maven 在 jar 的路由中放置了随机空格。例如:../lib/libform s-1.3.0.Jar ... 所以,当我午餐 mi jar 时,我得到一个错误,因为它找不到罐子。有任何想法吗?