2011-07-27 66 views
1

我的项目和ant4eclipse有问题。如果我运行的build.xml我得到这个消息:ant4eclipse classpath问题

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"/ 

回答

3

你有没有在你的.classpath什么是集装箱拆装。这是一种简写,意思是“包括所有属于这个容器的罐子”。哪个罐子构成容器的定义存储在工作空间的.metadata目录(这些定义是工作空间范围的,不限于特定项目的范围)中名为variablesAndContainers.dat的文件中。

据我所知,ant4eclipse可以读取.classpath files,但不是variablesAndContainers.dat文件(这在前几年我使用ant4eclipse的时候确实是这样)。这意味着尽管它可以找到你有一个类路径条目的容器,但是它找不到该容器的定义。

所以,无论你使用一个容器,你必须提供它的定义ant4eclipse,在ant4eclipse:jdtClassPathLibrary元素的形式,正是因为错误消息说:

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

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

+0

你是我的英雄! variablesAndContainers.dat包含jar的所有缺少路径:-) –