GWT plugin run configuration + maven dependencies issue

Hiya,

Trying out IntelliJ on a small maven 2, GWT project.  Got most things working pretty quickly, but ran into an issue with one maven external dependency jar which was marked as "provided" scope.  This jar was not present in the classpath when I launched from within intellij.  If I remove the "provided" scope, it is present, and the app works.

This makes sense so far, but here is the problem.  The particular jar is only used in the IDE, it is "commons-dbcp" and is used to connect to the database.  When deployed, we use a container datasource looked up via JNDI, so commons-dbcp is not needed in the deployed runtime environments - only for developers running inside their IDE.  If I remove the "provided" scope, the jar will be unnecessarily included in the deployed war.

Solution?  I have tried:
- marking scope as "test".  GWT launch inside intellij still does not pick up the jar in the classpath.
- removing the provided scope, but putting the dependency inside a maven profile, and selecting that profile as active in the maven tab in intellij.  same problem - gwt launch inside intellij does not pick up the jar.

In eclipse, there is a way in the run configuration to force a particular jar to be added that is not normally on the project classpath.  I don't see a similar option inside intellij, and in any case that's a little bit of a kluge because it's something that isn't in your pom that developers need to know to do manually to get the thing to run.  But at this point, since it's one jar, I'd accept that...

May be more of a GWT plugin issue / question than an intellij one.

1 comment
Comment actions Permalink

Got this to work using a profile, but there appears to be a bug.  Just not sure if it is an intellij bug or a plugin bug.  Here is how we got it to work:

The dependency that was not being included was in a maven module called "appconfig".  The module with the GWT entry point class was "web".  In the maven pom for web, "appconfig" was declared as a dependency for web maven module.  Originally we tried putting the maven profile in the appconfig pom, since the code that actually needed commons-dbcp was in config, and thus the declaration of the dependency for commons-dbcp was in appconfig.  This resulted in launch of GWT in intellij failing to pick up commons-dbcp, even though profile was selected as active.

However, if we copy the exact same profile, with embedded commons-dbcp dependency, to the "web" maven module's pom file, it works.  The GWT launch picks up that jar when the profile is active.

So somehow, when the GWT plugin is building the jars it needs for the classpath, it fails to apply profiles that are active for maven modules that are dependencies of the targeted web module?

0

Please sign in to leave a comment.