我有一个 ANT 构建,可以编译我的 Java 项目并构建一个 jar。 ANT 目标为 jar 创建一个 list 类路径。一切都很好。
现在,我想添加一个句点“.”到 list 类路径的开头,以便运行时工作目录位于类路径上。我该如何使用 manifestclasspath
来做到这一点?
我的 list 类路径示例:
<manifestclasspath property="foobar.manifest.classpath" jarfile="whocares.jar">
<classpath >
<pathelement path="."/>
<!-- :-( adds the working directory of the build. -->
<pathelement location="lib/some.jar"/>
<pathelement location="lib/someother.jar"/>
<fileset dir="${foobar.lib.dir}">
<include name="**/*.jar" />
</fileset>
</classpath>
</manifestclasspath>
<pathelement path="."/>
将构建的工作目录添加到我的 list 类路径中,这不是我想要的。我只是想要一个时期。
这就是我想要的 jar 类路径:
Class-Path: . lib/some.jar lib/someother.jar lib/blah.blah.blah.blah.b
lah.blah.jar /lib/and-on-and-on.jar
关键是 ' .
' 作为类路径中的第一项。
如何让 ANT 添加文字 ' .
' 到 list 类路径?
最佳答案
你不能手动添加前缀吗:
<property name="theRealManifestClasspath" value=". ${foobar.manifest.classpath}"/>
关于java - Apache ANT list 类路径文字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5889828/