How to add containers to eclipse classpath

Trying to figure out how to create these two containers via the eclipse plugin, but can’t find much relevant documentation:

<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v5.0">
	<attributes>
		<attribute name="owner.project.facets" value="jst.web"/>
	</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/MyFaces-1.1.3">
	<attributes>
		<attribute name="org.eclipse.jst.component.nondependency" value=""/>
		<attribute name="owner.project.facets" value="jst.jsf"/>
	</attributes>
</classpathentry>

Anybody have any pointers on this? or how I can work out what’s possible via documentation or source code?

I tried this for the first one
containers 'org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v5.0'

but got this:

org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method containers() for arguments [org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v5.0] on object of type org.gradle.plugins.ide.eclipse.model.EclipseModel.

The Eclipse Plugins documentation doesn’t suggest that what you’re trying to do is something that plugin offers as an out-of-the-box feature .

That error message is right though about EclipseModel. I Could not find method containers() in that class when I looked either.

There is a Container class in that plugin’s project, however. I don’t think it is the kind of container you’re looking for though.

If doing what you want is doable with the Eclipse plugin, the docs suggest that @donat and co. don’t want to let us in on the secret of how to :wink:

I’m thinking that what you want to do (create an embedded application server in an Eclipse project?) can only be done within the actual IDE itself.

But if you do prove me wrong, and I’m actually hoping I am, then whenever you do figure it out please share how you did it with the rest of us here? There should be no secrets between friends :wink:

The error message is correct: EclipseModel doesn’t have a containers() method, EclipseClasspath does. Use the following snippet to define the classpath container:

eclipse {
  classpath {
    containers 'org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v5.0' 
  }
}
1 Like