jiakuan / gwt-gradle-plugin

Gradle plugin to support GWT related tasks.
https://gwt-gradle.docstr.org
Other
63 stars 34 forks source link

.classpath needs manual fixes #46

Open blacatena opened 3 years ago

blacatena commented 3 years ago

We recently upgraded our environments to the latest Eclipse release (2021 03) and Gradle (7.1), and are using GWT 2.8.1 with the GWT plugin 3.0.

The end result has several errors that must be fixed manually in .classpath (using the Eclipse UI, but it could be done by editing .classpath) after any build (which is only done when we change any dependencies, otherwise we just code-and-test).

Our problems:

1) The default output is set to /bin/main, which generates an error on the project (presumably produced by the GWT plugin, the the source of the error is Unknown). The fix is to add a classpathentry with kind="output" and the GWT-desired path of war/WEB-INF/classes to the end of .classpath.

2) It complains that there is no GWT SDK. The fix is to add a classpathentry with kind="con" and path = the proper GWT version (com.gwtplugins.gwt.eclipse.core.GWT_CONTAINER/gwt-2.8.1). This by itself is not good enough in our application, as it is sensitive to the order of the class path entries. This entry must come after the classpathentry for the JRE but before that for the web container and buildship.

3) It sets the output for src/main/java to the standard default, bin/main, which results in all automatic build code going there instead of into war/WEB-INF/classes (which means that during active development, one must constantly run a build to get the latest code). We fix this by removing the output designation from src/main/java, allowing it to go to the default location for the project (which GWT required be set to war/WEB-INF/classes in step 1 above). I have tried using sourceSets to get gradle to do this properly within gradle, but none of my attempts have succeeded.

It is my presumption that we are doing something wrong, and that all of this would work properly otherwise, but days of research and trial and error has failed to resolve these problems. It has been very frustrating. It took a lot of trial and error to figure out the work arounds (we are a small shop, without "build engineers", so our contact with gradle is fleeting and "just as much as necessary", and so we lack a strong grasp of gradle (let alone gradle + GWT + eclipse plugins + gradle plugins), which makes managing this very difficult.

I can send along (privately, our code is proprietary) any source files you might need to look at to resolve this.

blacatena commented 3 years ago

Slight correction... I'd forgotten that we did fix problem 1 through gradle, by adding a destinationDirectory setting to the eclipse {} configuration, so really we are only left with problems 2 and 3, the lack of a proper classpath entry for GWT, and fixing the default output for src/main/java (which I presume can be done with sourceSets, but I just can't get it to work).

jiakuan commented 3 years ago

The latest plugin code doesn’t include anything related to Eclipse any more. So it will be all configurations in Gradle and Eclipse.

On Wed, 16 Jun 2021 at 9:36 pm, Bob Lacatena @.***> wrote:

Slight correction... I'd forgotten that we did fix problem 1 through gradle, by adding a destinationDirectory setting to the eclipse {} configuration, so really we are only left with problems 2 and 3, the lack of a proper classpath entry for GWT, and fixing the default output for src/main/java (which I presume can be done with sourceSets, but I just can't get it to work).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jiakuan/gwt-gradle-plugin/issues/46#issuecomment-862386342, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAECF5C25JTBHFD26PA6CP3TTCSE3ANCNFSM46ZLDO2Q .

tequilacat commented 2 years ago

Slight correction... I'd forgotten that we did fix problem 1 through gradle, by adding a destinationDirectory setting to the eclipse {} configuration, so really we are only left with problems 2 and 3, the lack of a proper classpath entry for GWT, and fixing the default output for src/main/java (which I presume can be done with sourceSets, but I just can't get it to work).

I try to build a gradle-based GWT project from pure Eclipse project, have found this plugin, have similar problems

the 2:

I have to manually enable GWT for the Eclipse project in GWT settings after each "Refresh gradle project" Yet I have Classpath entry com.gwtplugins.gwt.eclipse.core.GWT_CONTAINER will not be exported or published. Runtime ClassNotFoundExceptions may result warning, still have to deal with it.

1 and 3 are resolved via eclipse plugin:

eclipse {
    classpath { 
        defaultOutputDir = file('war/WEB-INF/classes')  // the 1

        file { 
            whenMerged { // the 3
                def src = entries.find { it.path == 'src/main/java' }
                src.output = null
            }
        }
    }
}

Then I have The web.xml file does not exist error even when I have web.xml in src/main/webapp/WEB-INF - it is not copied into war/ automatically and is not used from src location. I wonder if it should be covered by this plugin or by some standard gradle/war plugin feature, I'm a newbie in gradle.

The base of this plugin (steffenschaefer.github.io/gwt-gradle-plugin) mentions

The webapp source (typically /src/main/webapp) is holy and won't be polluted with generated stuff. Instead a special working dir is set up with an exploded template of the webapp (typically /war)

but doesn't explain how the web.xml gets into this /war path.