GWT Plugin for Maven with Polymer (jsinterop)

220 views
Skip to first unread message

N Troncoso

unread,
Jan 13, 2016, 7:34:51 AM1/13/16
to GWT Users
Switching to the Maven Plugin for GWT, I'm unable to get GWT to recognize the jsinterop flag. I'm assuming not many people using this plugin are using jsinterop, because I can only find a single source about it: https://github.com/tbroyer/gwt-maven-plugin/issues/22

In which there is no answer. I've tried putting:

<compilerArgs>
    <compilerArg>-XjsInteropMode</compilerArg>
    <compilerArg>JS</compilerArg>
</compilerArgs>
<codeserverArgs>
    <arg>-XjsInteropMode</arg>
    <arg>JS</arg>
</codeserverArgs>

in the parent pom under the gwt-maven-plugin configuration, as well as in the client, as well as both. Since I'm using GWT 2.8, I've also tried the -generateJsInteropExports flag. When I try to run the application, I get:


In the codeserver logs, I see:

 Arguments: com.google.gwt.dev.codeserver.CodeServer -logLevel DEBUG -workDir <snip>\target\gwt\codeserver -sourceLevel 1.8 -failOnError -launcherDir <snip>\target\gwt\launcherDir -XjsInteropMode JS -allowMissingSrc -src <snip>\client\src\main\java -src <snip>\shared\src\main\java com.ecrsoft.supportnet.Main

 The experimental -XjsInteropMode option is deprecated and will be removed very soon. See https://goo.gl/uMdOQS for migration instructions.


Which tells me the flag is being recognized.

I see lines like this that make me think it's getting compiled:

[INFO]             Resolving annotation for jsinterop.annotations.JsMethod
[INFO]          Resolving method $isInstance
[INFO]             Resolving annotation for jsinterop.annotations.JsMethod


But it still gives me that error. I've been looking at this for several days. 
Turning on jsinterop with mojo's plugin works fine, so I have to determine that the issue is with this plugin. That issue I link above was closed back in April. Has no one at all seriously tried using this plugin with polymer since then? I'm only using jsinterop for Polymer, so I don't have any existing annotations or anything. I'm very open to suggestions. Thanks.

Thomas Broyer

unread,
Jan 13, 2016, 8:47:18 AM1/13/16
to GWT Users
jsinterop.annotations.* require -XjsInteropMode JS_RC, which BTW is now the default in 2.8.0-SNAPSHOT (i;e. you don't even need to pass -XjsInteropMode). The legacy "-XjsInteropMode JS" (which should be gone in 2.8.0) uses com.google.gwt.core.js.* annotations.
I don't know GWT-Polymer much (not even sure which project you're talking about; gwt-polymer-elements from Vaadin?), but it's possible that they moved to the new annotations but forgot to update their error message. Or it might be a totally unrelated issue (like forgetting to load polymer.js)

N Troncoso

unread,
Jan 13, 2016, 9:16:30 AM1/13/16
to GWT Users
Thanks for that. Nothing you said was the issue, but it prompted me to double check my GWT version. It turns out I was using 2.8 beta instead of SNAPSHOT. I guess your plugin doesn't work with beta? Before switching, I was using beta for my gwt version and snapshot for my mojo plugin version and everything was good. Granted, maybe the -XjsInteropMode flag was removed in beta, which would explain the issue. I didn't think it'd be removed until release.
Reply all
Reply to author
Forward
0 new messages