How to declare standard java libraries dependencies to the GWT compiler with the tbroyer maven plugin?

114 views
Skip to first unread message

Bruno Salmon

unread,
Aug 26, 2016, 9:36:52 AM8/26/16
to GWT Users
hi,

Having read the deprecation notice, I'm trying to move from the mojo plugin to the new recommended plugin, the one written by Thomas.

But I'm facing this problem: my GWT application uses some java libraries (standard jar packaging but with GWT compatible sources), however the GWT compiler can't find these sources although I have listed these libraries in the application pom:

        <dependency>
           
<groupId>lib1-groupId</groupId>
           
<artifactId>lib1-artifactId</artifactId>
           
<version>lib1-version</version>
       
</dependency>
       
<dependency>
           
<groupId>lib2-groupId</groupId>
           
<artifactId>lib2-artifactId</artifactId>
           
<version>lib2-version</version>
       
</dependency>
        ...

With the mojo plugin already it was not enough to just declare their dependencies in the pom, I had to declare them a second time in the compileSourceArtifacts section of the plugin configuration, like this:

        <configuration>
        ...
           
<compileSourcesArtifacts>
               
<compileSourcesArtifact>lib1-groupId:lib1-artifactId</compileSourcesArtifact>
               
<compileSourcesArtifact>lib2-groupId:lib2-artifactId</compileSourcesArtifact>
                ...
           
</compileSourcesArtifacts>
       
</configuration>

and then the GWT compiler could find the sources of these libraries and include them for the application compilation.

I haven't seen the equivalent with the tbroyer plugin.
Anybody knows how to do it?

Thomas Broyer

unread,
Aug 26, 2016, 10:51:21 AM8/26/16
to GWT Users
Add dependencies to the source artifacts in addition to the "binary" ones:

        <dependency>
            
<groupId>lib1-groupId</groupId>
            
<artifactId>lib1-artifactId</artifactId>
            
<version>lib1-version</version>
            <classifier>sources</classifier>

        </dependency>
        
<dependency>
            
<groupId>lib2-groupId</groupId>
            
<artifactId>lib2-artifactId</artifactId>
            
<version>lib2-version</version>
            <classifier>sources</classifier>
        </dependency>
        ...

See the description of the different kind of dependencies in the home page: https://tbroyer.github.io/gwt-maven-plugin/

Ignacio Baca Moreno-Torres

unread,
Aug 27, 2016, 3:53:07 AM8/27/16
to GWT Users
I updated the 'deprecation notice', deprecation is a strong word and people get scared that the plugin is going to disappear. But the idea is the same, you should migrate if you can, so thanks Bruno Salmon to try it out!

Bruno Salmon

unread,
Aug 27, 2016, 7:57:01 AM8/27/16
to GWT Users
Thanks Ignacio, I understood your plugin won't disappear but as I'm upgrading a project to the future GWT way (removing widgets, using elemental, etc...), it's the opportunity to include this migration as well.

Thanks Thomas, I was focusing on the plugin goals pages and didn't notice the answer was in the introduction page! Sorry...

Now the GWT compilation works :-)

Just a couple of questions:

- my GWT app is part of a mutli maven modules project (and some are GWT modules) but although the plugin seems to analyse the GWT app dependencies, I need to declare all these sources in the app pom. It doesn't work if I declare them in the dependent modules. So it's a long flat list of all sources directly or indirectly used by the dependent modules. It's a bit hard to maintain that long list here. I would have preferred to be able to declare these sources dependencies just besides the binary dependencies (binary / sources pair) in the different modules poms. Or perhaps it should work but I'm doing something wrong? 

- I haven't found where to put the html host page and other static web resources in the project layout (I suspect somewhere under src/main/resources/) so the gwt-app packaging include them in the final war artifact.
Reply all
Reply to author
Forward
0 new messages