Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Something has changed in rc-7 and multi-module devmode dosen't work #86

Closed
ibaca opened this issue May 17, 2017 · 18 comments
Closed

Something has changed in rc-7 and multi-module devmode dosen't work #86

ibaca opened this issue May 17, 2017 · 18 comments
Labels
invalid This doesn't seem right

Comments

@ibaca
Copy link
Contributor

ibaca commented May 17, 2017

This might not be a bug, but gwt:devmode has stop working after upgrading to rc-7 in this project (https://github.com/intendia-oss/rxgwt). To reproduce the problem just execute mvn clean gwt:devmode (I just added clean because if you use the rc-6 plugin and change it to rc-7 without cleaning the project it might work). This command should open devmode with the 3 submodules accessible and correctly compiled at http://localhost:8888.

@TDesjardins
Copy link

This is also reproducable with https://github.com/TDesjardins/gwt-ol3/ .

@TDesjardins
Copy link

I found a warning while compiling when running devmode with rc-7:

[WARN] Some stale types ([list with classes..]) were not reprocessed as was expected. This is either a compiler bug or a Generator has legitimately stopped creating these types.

@tbroyer
Copy link
Owner

tbroyer commented May 18, 2017

@TDesjardins This is actually (more or less) working as intended.

[DEBUG] Adding sources for com.github.tdesjardins:gwt-ol3-demo:gwt-app:HEAD-SNAPSHOT
[DEBUG] Ignoring com.google.gwt:gwt-user:jar:2.8.1; neither a gwt-lib or jar:sources.
[DEBUG] Ignoring com.google.gwt:gwt-dev:jar:2.8.1; neither a gwt-lib or jar:sources.
[DEBUG] Ignoring com.github.tdesjardins:gwt-ol3:jar:HEAD-SNAPSHOT; neither a gwt-lib or jar:sources.
[DEBUG] Arguments: com.google.gwt.dev.DevMode -logLevel DEBUG -workDir
…/gwt-ol3/target/gwt/devmode/work -sourceLevel 1.8 -war …/gwt-ol3/target/gwt/devmode/war
-startupUrl /demo -XdisableUpdateCheck com.github.tdesjardins.ol3.demo.GwtOL3Playground
[DEBUG] Classpath: …/gwt-ol3/gwt-ol3-demo/src/main/java:…/gwt-ol3/gwt-ol3-demo/target/generated-
sources/annotations:…/gwt-ol3/gwt-ol3-demo/target/classes:…/.m2/repository/com/google/gwt/gwt-
user/2.8.1/gwt-user-2.8.1.jar:[…]:…/gwt-ol3/gwt-ol3-client/target/classes:
…/.m2/repository/com/google/code/findbugs/jsr305/3.0.0/jsr305-3.0.0.jar

With rc-6, the sources where copied into gwt-ol3/gwt-ol3-client/target/classes, so including it in the classpath was enough; but it was actually broken because one would expect gwt-ol3-gwt-ol3-client/src/main/java to be in the classpath, so you could edit a file in there, hit refresh in the browser, and immediately see the result.

With rc-7, sources are no longer copied to target/classes (see #55, among others), which is why you get all these errors about the sources not being found. As the message above suggests, you should use <type>gwt-lib</type> to the dependency; but then it uncovers another issue:

[DEBUG] Adding sources for com.github.tdesjardins:gwt-ol3-demo:gwt-app:HEAD-SNAPSHOT
[DEBUG] Ignoring com.google.gwt:gwt-user:jar:2.8.1; neither a gwt-lib or jar:sources.
[DEBUG] Ignoring com.google.gwt:gwt-dev:jar:2.8.1; neither a gwt-lib or jar:sources.
[DEBUG] Ignoring com.github.tdesjardins:gwt-ol3:gwt-lib:HEAD-SNAPSHOT; no corresponding project reference.
[DEBUG] Arguments: com.google.gwt.dev.DevMode -logLevel DEBUG -workDir 
…/gwt-ol3/target/gwt/devmode/work -sourceLevel 1.8 -war …/gwt-ol3/target/gwt/devmode/war 
-startupUrl /demo -XdisableUpdateCheck com.github.tdesjardins.ol3.demo.GwtOL3Playground
[DEBUG] Classpath: …/gwt-ol3/gwt-ol3-demo/src/main/java:…/gwt-ol3/gwt-ol3-demo/target/generated-
sources/annotations:…/gwt-ol3/gwt-ol3-demo/target/classes:…/.m2/repository/com/google/gwt/gwt-
user/2.8.1/gwt-user-2.8.1.jar:[…]:…/.m2/repository/com/github/tdesjardins/gwt-ol3/HEAD-
SNAPSHOT/gwt-ol3-HEAD-SNAPSHOT.jar:…/.m2/repository/com/google/code/findbugs/jsr305/3.0.0/jsr305-3.0.0.jar

In other words, it still doesn't work, and it now resolves the gwt-lib from the (remote) repository (downloading it if needed), because gwt:devmode only executes up to the process-classes phase, so Maven doesn't know about the gwt-lib artifact (and BTW, we don't want it to know about it, as we want it to resolve to the target/classes and not the packaged JAR).

BUT, it works for my tests because I never deploy the gwt-lib snapshots that I use in reactors that also have gwt-apps. Let's delete the snapshot from the local repo and run gwt:devmode again but --offline!

[DEBUG] Adding sources for com.github.tdesjardins:gwt-ol3-demo:gwt-app:HEAD-SNAPSHOT
[DEBUG] Ignoring com.google.gwt:gwt-user:jar:2.8.1; neither a gwt-lib or jar:sources.
[DEBUG] Ignoring com.google.gwt:gwt-dev:jar:2.8.1; neither a gwt-lib or jar:sources.
[DEBUG] Adding sources for com.github.tdesjardins:gwt-ol3:gwt-lib:HEAD-SNAPSHOT
[DEBUG] Ignoring com.google.gwt:gwt-user:jar:2.8.1; neither a gwt-lib or jar:sources.
[DEBUG] Ignoring com.google.gwt:gwt-dev:jar:2.8.1; neither a gwt-lib or jar:sources.
[DEBUG] Ignoring com.google.code.findbugs:jsr305:jar:3.0.0; neither a gwt-lib or jar:sources.
[DEBUG] Arguments: com.google.gwt.dev.DevMode -logLevel DEBUG -workDir 
…/gwt-ol3/target/gwt/devmode/work -sourceLevel 1.8 -war …/gwt-ol3/target/gwt/devmode/war 
-startupUrl /demo -XdisableUpdateCheck com.github.tdesjardins.ol3.demo.GwtOL3Playground
[DEBUG] Classpath: …/gwt-ol3/gwt-ol3-demo/src/main/java:…/gwt-ol3/gwt-ol3-demo/target/generated-
sources/annotations:…/gwt-ol3/gwt-ol3-client/src/main/java:…/gwt-ol3/gwt-ol3-client/target/generated-
sources/annotations:…/gwt-ol3/gwt-ol3-demo/target/classes:…/.m2/repository/com/google/gwt/gwt-
user/2.8.1/gwt-user-2.8.1.jar:[…]:…/gwt-ol3/gwt-ol3-client/target/classes:
…/.m2/repository/com/google/code/findbugs/jsr305/3.0.0/jsr305-3.0.0.jar

💥 BAM! 💥 👊

Maven is driving me nuts; it's so utterly broken you really have to wonder why it continues to attract people… At that point, I'm about to give up. Do me a favor everyone, do yourself a favor: move to Gradle, please!

@tbroyer
Copy link
Owner

tbroyer commented May 18, 2017

@ibaca This is exactly the same issue in rxgwt:

[DEBUG] Adding sources for com.intendia.gwt.rxgwt:rxgwt-example-elemental:gwt-app:HEAD-SNAPSHOT
[DEBUG] Ignoring com.intendia.gwt.rxgwt:rxgwt:jar:HEAD-SNAPSHOT; neither a gwt-lib or jar:sources.
[DEBUG] Ignoring com.intendia.gwt:rxjava-gwt:jar:1.3.0-beta2; neither a gwt-lib or jar:sources.
[DEBUG] Ignoring com.google.gwt:gwt-user:jar:2.8.1; neither a gwt-lib or jar:sources.
[DEBUG] Ignoring com.google.gwt:gwt-dev:jar:2.8.1; neither a gwt-lib or jar:sources.
[DEBUG] Ignoring com.google.gwt:gwt-elemental:jar:2.8.1; neither a gwt-lib or jar:sources.
[DEBUG] Ignoring com.google.code.findbugs:jsr305:jar:3.0.0; neither a gwt-lib or jar:sources.
[DEBUG] Adding sources for com.intendia.gwt.rxgwt:rxgwt-example-elemental2:gwt-app:HEAD-SNAPSHOT
[DEBUG] Ignoring com.intendia.gwt.rxgwt:rxgwt:jar:HEAD-SNAPSHOT; neither a gwt-lib or jar:sources.
[DEBUG] Ignoring com.intendia.gwt:rxjava-gwt:jar:1.3.0-beta2; neither a gwt-lib or jar:sources.
[DEBUG] Ignoring com.google.gwt:gwt-user:jar:2.8.1; neither a gwt-lib or jar:sources.
[DEBUG] Ignoring com.google.gwt:gwt-dev:jar:2.8.1; neither a gwt-lib or jar:sources.
[DEBUG] Ignoring com.google.elemental2:elemental2-dom:jar:1.0.0-beta-1; neither a gwt-lib or jar:sources.
[DEBUG] Ignoring com.google.code.findbugs:jsr305:jar:3.0.0; neither a gwt-lib or jar:sources.
[DEBUG] Adding sources for com.intendia.gwt.rxgwt:rxgwt-example-widgets:gwt-app:HEAD-SNAPSHOT
[DEBUG] Ignoring com.intendia.gwt.rxgwt:rxgwt:jar:HEAD-SNAPSHOT; neither a gwt-lib or jar:sources.
[DEBUG] Ignoring com.intendia.gwt:rxjava-gwt:jar:1.3.0-beta2; neither a gwt-lib or jar:sources.
[DEBUG] Ignoring com.google.gwt:gwt-user:jar:2.8.1; neither a gwt-lib or jar:sources.
[DEBUG] Ignoring com.google.gwt:gwt-dev:jar:2.8.1; neither a gwt-lib or jar:sources.
[DEBUG] Ignoring com.google.code.findbugs:jsr305:jar:3.0.0; neither a gwt-lib or jar:sources.

TL;DR: use <type>gwt-lib</type> on your dependencies, and because you deploy them to Sonatype OSSRH (and have that repo configured, inherited from the –deprecated btw– oss-parent), you also need to pass --offline to avoid resolving them.

“Fixing” your POMs to no longer use oss-parent (see http://central.sonatype.org/pages/apache-maven.html), and as a side-effect remove the Sonatype OSSRH snapshot repository, might also work (Maven would be unable to resolve the snapshot, which would hopefully lead to the same situation as when running --offline)

The <type>gwt-lib</type> is explicitly called out in https://tbroyer.github.io/gwt-maven-plugin/codeserver.html so I'm going to close this issue. But feel free to propose improvements to the documentation.

@tbroyer tbroyer closed this as completed May 18, 2017
@tbroyer tbroyer added the invalid This doesn't seem right label May 18, 2017
@ibaca
Copy link
Contributor Author

ibaca commented May 18, 2017

Thanks!

Yep, migrating to Gradle is definitely a top priority, I recently have been experimenting and it makes this mini change in the RxJava gradle.build (https://github.com/ibaca/RxJava/blob/1.x-gwt/build.gradle#L181) to create a task to verify GWT compilation, clean and explicit, pretty cool.

@TDesjardins
Copy link

Thanks for the detailed explanation!

Because i am not proficient in Maven I didn't get all the things you have written. I changed the pom TDesjardins/gwt-ol@7e97687 and it now works for me.

I think Maven attract people because it is widely spread and supported. And if you are working on an existing Maven project it is easier to add a dependency than move to a new build system.

Gradle looks very interesting. But I think you also have to provide Maven support to attract people to use your stuff.

@ibaca
Copy link
Contributor Author

ibaca commented Jun 4, 2017

This is crazy, it is too easy to install your artifact (so start using obsolete sources) and too difficult to realize that this is the cause. Using normal+sources dependencies works fine, I think that maybe it is just better to remove type:gwt-lib support.

@tbroyer
Copy link
Owner

tbroyer commented Jun 4, 2017

This is crazy, it is too easy to install your artifact (so start using obsolete sources)

Particularly given 99% of people typing mvn install are just cargo-culting without knowing what they're doing.
/rant

I think that maybe it is just better to remove type:gwt-lib support.

You mean include the sources from any other project from the reactor that is depended on? (irrespective of <classifier>sources</classifier> or <type>gwt-lib</type>) Well, why not, but then things might not work with gwt:compile or gwt:test because you're missing the sources (still, maybe better fail than use stale sources); things might also work differently because gwt:codeserver or gwt:devmode might include sources that hide/shadow other sources that will be used by gwt:compile or gwt:test (though that's an edge-case).

Worth considering. Possibly more pros than cons. Let me think more about it.

@ibaca
Copy link
Contributor Author

ibaca commented Jun 4, 2017

Nop, I mean to use both normal and classifer:soruces dependencies in inter-module dependencies. This is currently working correctly (I think... 😅), so just stop using type:gwt-lib.

@tbroyer
Copy link
Owner

tbroyer commented Jun 4, 2017

Which means that either the "normal" jar does not contain sources (i.e. is not a gwt-lib, and does not use gwt-lib packaging, which means more configuration in the POMs), or that you'd include the sources twice during tests and compilation (means more files to scan, uselessly).

Maybe I could change the messages about which source folders from reactor projects are included, and which dependencies are skipped, to be of level INFO rather than DEBUG? That would help in debugging.

@TDesjardins
Copy link

I can confirm that the solution of @ibaca works perfectly fine. After running into a caching issue (loading (stale) lib from repository) that you mentioned before when using type:gwt-lib I tried the solution of @ibaca (see TDesjardins/gwt-ol@a80760a). Now it works like a charme with the additional benefit that you can change the lib code while running devmode.

@tbroyer
Copy link
Owner

tbroyer commented Jun 27, 2017

FWIW, I finally understood why the project reference wasn't found! (``) This is because the key used to lookup the referenced project uses the resolved snapshot version (com.github.tdesjardins:gwt-ol3:HEAD-20170626.165147-97 vs `com.github.tdesjardins:gwt-ol3:HEAD-SNAPSHOT`). This went unnoticed because `Artifact`'s `getId()` uses `getBaseVersion()` (`HEAD-SNAPSHOT`) whereas `ArtifactUtils.key()` uses `getVersion()` (`HEAD-20170626.165147-97`). Using `getBaseVersion()` explicitly should properly match the referenced project and fix the issue (it'd still resolve the snapshot JAR from the repository and use it in the classpath vs. the project's `target/classes`, but it'd use the referenced project's sources; a workaround might be to use `mvn package -DskipTests gwt:codeserver` then that'd use the JAR from the reactor build; that'd leave us with one similar issue: changes to resources won't be taken into account)

@tbroyer
Copy link
Owner

tbroyer commented Jul 2, 2017

This should be fixed in latest SNAPSHOT by 7bed75a and 5cfe415. Anyone wants to try? (I quickly tried it myself on gwt-ol3) If that's OK, I'll release rc-8.

@TDesjardins
Copy link

I could test but seems that the latest build failed: https://travis-ci.org/tbroyer/gwt-maven-plugin/jobs/249377706

@tbroyer
Copy link
Owner

tbroyer commented Jul 3, 2017

The HEAD-SNAPSHOT artifacts of GWT are currently broken, but the plugin's snapshot is OK and has been published successfully (in the oraclejdk7 / GWT 2.7.0 build)

@TDesjardins
Copy link

Yes, works fine with gwt-ol3. I used the Snapshot, configured client lib in demo with with <type>gwt-lib</type> , started devmode, made some changes in the client code, reloaded the page and could see the changes.

@tbroyer
Copy link
Owner

tbroyer commented Jul 3, 2017

Thanks; currently releasing 1.0-rc-8, expect to see it soon in Central.

BTW, the GWT HEAD-SNAPSHOT “packaging” issue is being fixed in https://gwt-review.googlesource.com/c/18800/ (dates back to late May; I suppose those who use it also use JSR-305 annotations, the only reason for it to only be uncovered now)

@TDesjardins
Copy link

Thanks! 1.0-rc-8 is in MavenCentral now. Just integrated it in gwt-ol3: TDesjardins/gwt-ol@3e3bfef

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants