[Request for feedback] WTP support coming to Buildship

Hi everyone,

we are happy to announce that the next Buildship release (1.0.21) will include Eclipse WTP support. Here’s how it will work:

When Buildship detects the eclipse-wtp plugin on a project, it will call the eclipseWtp task, which generates the necessary metadata, before importing the project. All you need to do is to apply that plugin to your projects and use Gradle >= 3.0

We have published a snapshot to our update site and would be very happy to get some feedback on it. We plan to release the new feature in late September/early October.

Cheers,
Stefan

  1. the 1.0.21 snapshots not available on the snapshot update site, I have to build it manually on my local
  2. I have a multi-module gradle project, it’s follow the quite normal MVC module layout, saying rest -> service -> dao, the rest module is the web app, which depends on service module with compile project(':service'), service module in turn depends on dao with compile project(':dao'), but the problem is, neither dao, service jar (or classes) copied to .metadata/.plugins/org.eclipse.wst.server.core/tmpX/wtpwebapps, hence my app failed to start with error ClassNotFound
  3. the rest 3rd party jars not consistent between .metadata/.plugins/org.eclipse.wst.server.core/tmpX/wtpwebapps and the ones generate by gradle war

for issue #2, I got the following warning message on project properties:

Hey Nick,

Make sure you apply the ‘eclipse-wtp’ plugin to the service and dao project too. Wtp will not recognize them otherwise.

Cheers,
Stefan

thanks Stefan
that makes the trick, it works now, though it’s anti-intuitive to apply ‘eclipse-wtp’ plugin to dao and service project.
(I think it’s better to document somewhere so that others won’t be confused again, now I apply the plugin in allprojects)

one minor thing that I guess not a big deal, there is missing version number from the ‘dao’ and ‘service’ jar file name, while other third party jar all follow with version number:

-rw-r--r--  1 nick  staff    46K Sep  6 18:05 dao.jar
-rw-r--r--  1 nick  staff    82K Sep  1 01:35 disruptor-3.3.5.jar
-rw-r--r--  1 nick  staff   2.2M Jun 21 15:17 guava-18.0.jar
...
-rw-r--r--  1 nick  staff    16K Sep  6 18:05 service.jar
-rw-r--r--  1 nick  staff    40K Sep  1 00:30 slf4j-api-1.7.21.jar

I think this might be the issue of eclipse-wtp plugin, since the generated org.eclipse.wst.common.component does not specify the attr archiveName for dependent-module element:

<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="2.0">
	<wb-module deploy-name="rest">
		<property name="context-root" value="lottery-rest"/>
		<wb-resource deploy-path="/WEB-INF/classes" source-path="src/main/resources"/>
		<wb-resource deploy-path="/WEB-INF/classes" source-path="src/main/java"/>
		<wb-resource deploy-path="/" source-path="src/main/webapp"/>
		<dependent-module deploy-path="/WEB-INF/lib" handle="module:/resource/service/service">
			<dependency-type>uses</dependency-type>
		</dependent-module>
		<dependent-module deploy-path="/WEB-INF/lib" handle="module:/resource/dao/dao">
			<dependency-type>uses</dependency-type>
		</dependent-module>
	</wb-module>
</project-modules>

the expected output should be:

<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="2.0">
	<wb-module deploy-name="rest">
		<property name="context-root" value="lottery-rest"/>
		<wb-resource deploy-path="/WEB-INF/classes" source-path="src/main/resources"/>
		<wb-resource deploy-path="/WEB-INF/classes" source-path="src/main/java"/>
		<wb-resource deploy-path="/" source-path="src/main/webapp"/>
		<dependent-module archiveName="service-0.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/service/service">
			<dependency-type>uses</dependency-type>
		</dependent-module>
<!-- Nick: here is the missing attr 'archiveName' -->
		<dependent-module archiveName="dao-0.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/dao/dao">
			<dependency-type>uses</dependency-type>
		</dependent-module>
	</wb-module>
</project-modules>

Thanks for that feedback Nick! I take away the following improvements:

  • warn when a wtp project depends on a non-wtp project
  • configure archiveName in the component descriptor

The need for dependency project to have the wtp-plugin applied is a long standing issue tracked by:
https://issues.gradle.org/browse/GRADLE-1880

Hey Nick,

         Can you please provide the update site URL for 1.0.21 or the documentation for building it locally.

The update site is linked in the first post.

Want to say thank you for this - wtp directly in eclipse with gradle has been such a pain in the past and today I just tried this with a multi-project gradle solution clean out of the box, imported and it simply just worked.

3 Likes