开发者

ant4eclipse classpath problem

i have a problem with my project and ant4eclipse. If i run the build.xml i got this message:

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 

But where can i find the files? The .classpath file has just this entry:

classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"开发者_StackOverflow/


What you have there in your .classpath is a container entry. That's a sort of shorthand which means "include all the jars which are part of this container". The definition of which jars make up a container is stored in a file called variablesAndContainers.dat, in the workspace's .metadata directory (these definitions are workspace-wide, not scoped to a particular project).

As far as i know, ant4eclipse can read .classpath files, but not the variablesAndContainers.dat file (this was certainly true last time i used ant4eclipse, a couple of years ago). That means that although it can find that you have a classpath entry the org.eclipse.jst.j2ee.internal.module.container container, it cannot find out what the definition of that container is.

So, whenever you use a container, you have to supply a definition of it to ant4eclipse, in the form of an ant4eclipse:jdtClassPathLibrary element, exactly as the error message says:

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

The fileset tag should define the jar files which make up the container.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜