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

DevMode, gwt-lib dependency and re-compiling changes #31

Closed
timeu opened this issue Jul 28, 2015 · 6 comments
Closed

DevMode, gwt-lib dependency and re-compiling changes #31

timeu opened this issue Jul 28, 2015 · 6 comments

Comments

@timeu
Copy link

timeu commented Jul 28, 2015

I am not sure if this is a bug or by design:

I created a reactor project for a GWT library which contains 2 modules:

  • The library (packaging: gwt-lib) itself
  • A sample gwt app (packaging: gwt-app) as a showcase.

Initially the sample gwt app had a simple dependency to the library (no classifier and no type declared). However when I run mvn gwt:devmode from my reactor project, changes to the library code (gwt-lib) are not picked up (re-compiled). Only changes to the sample app are re-compiled.

The debug output shows the following line:

[DEBUG] Ignoring com.github.timeu.dygraphs-gwt:dygraphs-gwt:jar:1.0.0-SNAPSHOT; neither a java-source, gwt-lib or jar:sources.

If I add a second dependency to the library with a classifier of type sources or with a type of gwt-lib changes to the library will be properly re-compiled.
I looked into the documentation and the only thing regarding this, was here:
https://tbroyer.github.io/gwt-maven-plugin/artifact-handlers.html

I also looked into the integration tests and only found the type of the dependency to be set to gwt-lib here:

This is with JDK 1.8.0_45, Maven 3.2.1 and gwt-maven-plugin 1.0-rc-2

@tbroyer
Copy link
Owner

tbroyer commented Jul 28, 2015

Yes, sources from other projects in the reactor build are only added to the classpath by gwt:codeserver (and gwt:devmode) for dependencies that are known to contain sources: <classifier>sources</classifier> or <type>gwt-lib</type>. If you don't include <type>gwt-lib</type>, Maven assumes <type>jar</type> and the plugin assumes it only contains compiled classes (and resources).
Note that <type>gwt-lib</type> in a dependency doesn't necessarily mean that the project has/had <packaging>gwt-lib</packaging>. Those two gwt-lib have the same name but are different things as far as Maven is concerned (and similarly for the built-in jar, war, etc.)

Leaving this issue open as a reminder that the documentation needs improvement.

@timeu
Copy link
Author

timeu commented Jul 28, 2015

Great, thanks for clarifying.

Along these lines:
If I specify the dependency to the library in the sample app twice (one time with type gwt-lib and one time with jar) I get following error if I run mvn clean compile on the reactor project:

[ERROR] Failed to execute goal net.ltgt.gwt.maven:gwt-maven-plugin:1.0-rc-2:generate-module (default-generate-module) on project dygraphs-gwt-sample: Execution default-generate-module of goal net.ltgt.gwt.maven:gwt-maven-plugin:1.0-rc-2:generate-module failed. NullPointerException -> [Help 1]
....
Caused by: java.lang.NullPointerException
        at net.ltgt.gwt.maven.GenerateModuleMojo.generateInheritsFromDependencies(GenerateModuleMojo.java:242)

Not sure if this is a separate issue.

@tbroyer
Copy link
Owner

tbroyer commented Jul 28, 2015

Yes it's a separate issue (likely a bug, probably due to changes in Maven in recent versions).
BTW, you should either have one gwt-lib dep, or 2 deps without classifier and with classifier=sources.

@tbroyer tbroyer closed this as completed Jul 28, 2015
@tbroyer tbroyer reopened this Jul 28, 2015
@tbroyer
Copy link
Owner

tbroyer commented Nov 15, 2015

Fixed by 69ac0f3

@tbroyer tbroyer closed this as completed Nov 15, 2015
@timeu
Copy link
Author

timeu commented Feb 29, 2016

Sorry to spam this issue (isn't really a separate issue) but in case somebody ran into the same issue:

IntelliJ won't import dependencies if they are using with the gwt-lib type. To fix this, one has to go to FIle -> Settings -> Maven -> Importing and add gwt-lib to the list of automatically imported dependencies.

@mahoe
Copy link

mahoe commented Feb 2, 2021

Sorry to spam this issue (isn't really a separate issue) but in case somebody ran into the same issue:

IntelliJ won't import dependencies if they are using with the gwt-lib type. To fix this, one has to go to FIle -> Settings -> Maven -> Importing and add gwt-lib to the list of automatically imported dependencies.

If we call it a problem then it's still present. I figured out that the NPE happens i.e. if you mess up the dependencies in your pom.xml with two entries for the same dependency (one with type gwt-lib and the second without any classifier). The plugin version I used for that is 1.0.0, GWT version 2.9.0, maven 3.6.3.

...just wanted to give my two cents here if someone comes by with the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants