【问题标题】:ant4eclipse classpath problemant4eclipse 类路径问题
【发布时间】:2011-07-27 08:57:19
【问题描述】:

我的项目和 ant4eclipse 有问题。如果我运行 build.xml,我会收到以下消息:

Exception in thread "main" : org.ant4eclipse.lib.core.exception.Ant4EclipseException: Exception
whilst resolving the classpath entry '[EclipseClasspathEntry: path: 
org.eclipse.jst.j2ee.internal.module.container entryKind: 0 outputLocation: null exported: false]' of project 'MyProject': '

No 'jdtClassPathLibrary' defined for library entry 
'org.eclipse.jst.j2ee.internal.module.container'. 
To resolve this problem, please define a 'jdtClassPathLibrary' 
element inside your ant build file:

ant4eclipse:jdtClassPathLibrary name="org.eclipse.jst.j2ee.internal.module.container"  
fileset dir="..."/
/ant4eclipse:jdtClassPathLibrary 

但是我在哪里可以找到这些文件? .classpath 文件只有这个条目:

classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/

【问题讨论】:

    标签: java eclipse jakarta-ee ant4eclipse


    【解决方案1】:

    .classpath 中的内容是一个容器条目。这是一种简写,意思是“包括作为这个容器一部分的所有罐子”。哪些 jar 构成容器的定义存储在名为 variablesAndContainers.dat 的文件中,位于工作区的 .metadata 目录中(这些定义是工作区范围内的,不限于特定项目)。

    据我所知,ant4eclipse 可以读取.classpath files,但不能读取variablesAndContainers.dat 文件(几年前我上次使用ant4eclipse 时确实如此)。这意味着虽然它可以找到你有一个org.eclipse.jst.j2ee.internal.module.container容器的类路径条目,但它无法找出那个容器的定义是什么。

    因此,无论何时使用容器,都必须以 ant4eclipse:jdtClassPathLibrary 元素的形式向 ant4eclipse 提供它的定义,正如错误消息所述:

    <ant4eclipse:jdtClassPathLibrary name="org.eclipse.jst.j2ee.internal.module.container">
        <fileset dir="..."/>
    </ant4eclipse:jdtClassPathLibrary>
    

    fileset 标签应该定义组成容器的 jar 文件。

    【讨论】:

    • 你是我的英雄! variablesAndContainers.dat 包含所有缺少的 jar 路径:-)
    猜你喜欢
    • 2023-03-16
    • 2013-05-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-11
    • 2010-09-24
    相关资源
    最近更新 更多