简体   繁体   English

Apache ANT 清单类路径文字

[英]Apache ANT manifest classpath literal

I have an ANT build that compiles my Java project and builds a jar.我有一个 ANT 构建,它编译了我的 Java 项目并构建了一个 jar。 An ANT target creates a manifest classpath for the jar. ANT 目标为 jar 创建清单类路径。 Everything works great.一切都很好。

Now, I would like to add a period '.'现在,我想添加一个句号“。” to the beginning of the manifest classpath so that the runtime working directory is on the classpath.到清单类路径的开头,以便运行时工作目录位于类路径上。 How do I do that using manifestclasspath ?我如何使用manifestclasspath做到这一点?


My manifestclasspath example:我的清单类路径示例:

    <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="."/> adds the working directory of the build to my manifest classpath which is not what I want. <pathelement path="."/>构建工作目录添加到我的清单类路径中,这不是我想要的。 I just want a period.我只是想要一个时期。


This is what I want the jar classpath to look like:这就是我希望 jar 类路径看起来像的样子:

Class-Path: . lib/some.jar lib/someother.jar lib/blah.blah.blah.blah.b
lah.blah.jar /lib/and-on-and-on.jar

The key thing being the ' .关键是 ' . ' as the first item in the classpath. ' 作为类路径中的第一项。

How to I make ANT add the literal ' .如何让 ANT 添加文字 ' . ' to the manifest class path? ' 到清单 class 路径?

Couldn't you just prepend manually:你不能手动添加:

<property name="theRealManifestClasspath" value=". ${foobar.manifest.classpath}"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM