Java ant4eclipse类路径问题
我的项目和ant4eclipse有问题。如果运行build.xml,我会收到以下消息:Java ant4eclipse类路径问题,java,eclipse,jakarta-ee,ant4eclipse,Java,Eclipse,Jakarta Ee,Ant4eclipse,我的项目和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.cont
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"/
.classpath
中包含的是一个容器条目。这是一种简写,意思是“包括所有作为容器一部分的罐子”。构成容器的JAR的定义存储在工作区的.metadata
目录中名为variablesAndContainers.dat
的文件中(这些定义是工作区范围的,不适用于特定项目)
据我所知,ant4eclipse可以读取.classpath文件
,但不能读取变量和containers.dat文件(几年前我上次使用ant4eclipse时确实如此)。这意味着,尽管它可以发现您有一个类路径条目org.eclipse.jst.j2ee.internal.module.container
container,但它无法找到该容器的定义
因此,无论何时使用容器,都必须以ant4eclipse:jdtClassPathLibrary
元素的形式向ant4eclipse提供容器的定义,正如错误消息所说:
<ant4eclipse:jdtClassPathLibrary name="org.eclipse.jst.j2ee.internal.module.container">
<fileset dir="..."/>
</ant4eclipse:jdtClassPathLibrary>
fileset标签应该定义构成容器的jar文件。你是我的英雄!variablesAndContainers.dat包含jar的所有丢失路径:-)