【问题标题】:Ant task failing because of classpathAnt 任务因类路径而失败
【发布时间】:2011-11-24 04:35:46
【问题描述】:

当我在 ant 配置的 global 条目中没有 kodo jar 时,我的 kodoc jdo 增强策略失败。

在我的 Eclipse 环境中,我可以用 ant 构建代码就好了。但是当我在 ant 之外运行 ant 时,找不到 kodo jar 文件。

build.xml:106: taskdef class kodo.ant.PCEnhancerTask cannot be found

任务位于类路径中的 jar 文件 com.bea.core.kodo_1.0.0.0_4-2-0.jar 中。我用这个技巧把它打印出来了http://blog.andrewbeacock.com/2005/08/pretty-printing-java-classpaths-using.html

我已尝试重新排序 ant <path id="cp"> 中的项目,但这似乎没有效果。

我不知道如何使构建文件通用。

<target name="enhance">
    <available property="propfile" file="../../config/pebig.jdo.properties"/>
    <echo>base dir is ${basedir} props is ${propfile}</echo>

    <echo message="|-- compile classpath"/>
    <echo message="|   |"/>
    <echo message="|   |-- ${echo.path.compile}"/>

    <taskdef name="kodoc" classname="kodo.ant.PCEnhancerTask">
        <classpath refid="cp"/>
    </taskdef>

    <kodoc>
        <classpath refid="cp"/>
        <config propertiesFile="${configProperties}"/>
        <fileset dir="${srcdir}">
            <include name="**/*.jdo" />
        </fileset>
    </kodoc>

</target>

【问题讨论】:

    标签: eclipse ant


    【解决方案1】:

    这个语法有帮助吗,或者你已经在使用它了吗?

    <taskdef resource="propertiesfile name">
        <classpath>
            <fileset file="/path/to/jars"/>
        </classpath>
    </taskdef>
    

    请发布代码示例。

    【讨论】:

    • 答案中的代码需要格式化为代码,这样更容易阅读。
    • 将类路径添加到任务 def 会产生 java.util.MissingResourceException: C:\Documents and Settings\am4896\workspace\blue ebig\ebig\config\pebig.jdo.properties#null
    • MissingResourceException 不会出现在 eclipse 之外
    猜你喜欢
    • 1970-01-01
    • 2020-04-26
    • 1970-01-01
    • 1970-01-01
    • 2014-10-29
    • 2015-05-10
    • 2011-09-15
    • 2014-03-09
    • 1970-01-01
    相关资源
    最近更新 更多