[GRADLE-247] eclipse WTP project file generation is incomplete Created: 01/Oct/08 Updated: 04/Jan/13 Resolved: 22/Oct/08 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | 0.4 |
Fix Version/s: | 0.5 |
Type: | Bug | ||
Reporter: | Phil Messenger | Assignee: | Hans Dockter |
Resolution: | Fixed | Votes: | 1 |
Attachments: | expectedSimpleProjectFile.txt expectedWebApp1WtpFile.txt gradle-0.4-eclipse-wtp-2.patch gradle-eclipsewtp-cumulative-2.patch gradle-eclipsewtp-sample-and-docs.patch |
Description |
There are several issues with the Eclipse WTP project file generation a) the WTP facets are not added to the .project file in WTP apps, and the facet configuration is incomplete b) WTP facets are not added to dependent projects There are two files attached to this bug. The patch file adds two new project types to EclipseProject (WTP_WEBAPP and WTP_MODULE), complete with the right facets and builders. For these to work, it's necessary to add the following stanza to the build file: eclipseProject { projectType = ProjectType.WTP_WEBAPP } We may want to think about automatically defining the project type if the war plugin is present. The second file adds a new task, EclipseWtpModule. This should be executed in dependent projects that are required by WTP apps and adds some required facets. |
Comments |
Comment by Phil Messenger [ 01/Oct/08 ] |
patch against 0.4 I'm afraid, not the trunk. Future patches will be against the right branch / trunk! |
Comment by Phil Messenger [ 01/Oct/08 ] |
new task that generates configuration for Wtp modules (as opposed to web apps). |
Comment by Phil Messenger [ 07/Oct/08 ] |
Updated patch addressing issue in EclipseUtils when a project file is empty |
Comment by Helmut Denk [ 12/Oct/08 ] |
i will try eclipse-wtp-integration as soon as the patch is applied. one thing, i noticed regarding eclipse-integration is, that i have my eclipse-workspaces on a usb-disk and for some solution for this could be either to use eclipses classpath-variables |
Comment by Hans Dockter [ 13/Oct/08 ] |
I hope I can manage it to apply the patch today. There is already an issue about portable eclipse files: http://jira.codehaus.org/browse/GRADLE-196 |
Comment by Phil Messenger [ 13/Oct/08 ] |
additional fixes, cumulative against the first patch |
Comment by Phil Messenger [ 13/Oct/08 ] |
I've added a second patch which fixes a few small issues that have been shaken out in testing. One more patch to follow shortly with updated documentation. |
Comment by Phil Messenger [ 13/Oct/08 ] |
Attached a patch which introduces a new sample project "wtp-project" which demonstrates a multi module WTP project, and updated the war plugin documentation (my latex is a bit rusty...). |
Comment by Hans Dockter [ 13/Oct/08 ] |
Hi Phil, I have applied the first patch to my working copy. I have a couple of questions:
Cheers, Hans |
Comment by Phil Messenger [ 13/Oct/08 ] |
Yes, that's a hangover from some other, non submitted work I've been doing to hide the dom manipulations behind a proper model. Go ahead and ignore/remove it.
The wtpModule task makes a non-war project into a WTP module project and will typically be used in sibling projects that contain library code. It'd seemed more logical to add it to the JavaPlugin as most library projects won't produce Wars. Take a look at the same project in Patch 3 for a working example
Patch 2 is cumulative against Patch 1, so it should apply against both. Patch 3 is against trunk (as of this morning) |
Comment by Hans Dockter [ 13/Oct/08 ] |
Thanks. The patches I apply against 0.4 are merged afterwards into trunk. |
Comment by Hans Dockter [ 13/Oct/08 ] |
The EclipseProjectTest is failing: java.lang.AssertionError: Expected: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<projectDescription>\n <name>myProject</name>\n <comment/>\n <projects/>\n <natures/>\n <buildSpec>\n <buildCommand/>\n </buildSpec>\n</projectDescription>\n" got: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<projectDescription>\n <name>myProject</name>\n <comment/>\n <projects/>\n <natures/>\n <buildSpec/>\n</projectDescription>\n" at org.junit.Assert.assertThat(Assert.java:502) at org.junit.Assert.assertThat(Assert.java:492) at org.gradle.api.tasks.ide.eclipse.EclipseProjectTest.checkProjectFile(EclipseProjectTest.java:74) at org.gradle.api.tasks.ide.eclipse.EclipseProjectTest.generateSimpleProject(EclipseProjectTest.java:68) I'm wondering if this is caused somehow by my merging. Does this test works in your working copy? |
Comment by Phil Messenger [ 13/Oct/08 ] |
Sorry, took out too much from the patch file - ammended src/test/resources/org/gradle/api/tasks/ide/eclipse/expectedSimpleProjectFile.txt attached. |
Comment by Hans Dockter [ 13/Oct/08 ] |
Thanks. The unit tests are passing now. But the integration tests are failing. In buildSrc/src/main/groovy/org/gradle/build/integtests/JavaProject.groovy we run integration tests for eclipse file generation. To speed up to get to the integration tests I call the Gradle build like: gradle -s -Dskip.test -Dskip.javadoc -Dskip.groovydoc -Dskip.archive_all-jdk14_zip -Dskip.userguide -Dskip.archive_src_zip clean integTest |
Comment by Phil Messenger [ 13/Oct/08 ] |
Ah, was unaware of the integration builds. Attached is a modified buildSrc/src/main/resources/org/gradle/build/integtests/javaproject/expectedWebApp1WtpFile.txt
|
Comment by Hans Dockter [ 13/Oct/08 ] |
Hi Phil, everything works fine now. I have committed your code patches to trunk. Some comments/open issues:
I haven't applied your doc patch yet. Somehow it contains absolute paths from your machine. I could somehow extract the stuff. But if it is easy for you it would be handy to have a modified version. Thank you so much Phil. Good Eclipse support is essential for competing with Maven. |
Comment by Phil Messenger [ 13/Oct/08 ] |
Hans, I'll get a unit test for eclipseWtpModule written shortly. I've attached a new doc/sample patch. To apply it, you should just be able to invoke: patch --dry-run -p1 < ../gradle-eclipsewtp-sample-and-docs.patch in the root of your checked out tree (eg trunk/) |