Remove unnecessary dependency to gwt-user
suztomo opened this issue · 6 comments
Our static dependency analysis tool detected an error GoogleCloudPlatform/cloud-opensource-java#980 on gwt-user used by com.google.truth:truth:1.0
.
Discussed with @netdpb , it seems that Truth declares unnecessary dependency:
<!-- Required only to build the -gwt sub-artifact. -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<scope>provided</scope>
</dependency>
There's no "-gwt sub-artifact" found under com.google.truth: https://search.maven.org/search?q=g:com.google.truth .
Would you remove the dependency if not needed?
There is a truth-1.0-gwt.jar
in Maven Central. Possibly "sub-artifact" is the wrong term here?
As far as I can tell, though, we need it only to run the GWT tests. If I move it to test
scope, does that solve the problem? I would have guessed it would, but I see that Truth also depends on guava-gwt
, which depends on gwt-user
, so perhaps not?
Guava, for its part, may be able to remove its dependency after it removes GWT-RPC support -- supposedly in January but actually more like April or July to give some time for users who don't see the announcements. I'm poking around now a little to see if it looks likely to work.
Additionally: It's possible that the approach we've used for Truth is inferior to the approach we've used from Guava (of a completely separate pom.xml
file for the GWT support). Hopefully we won't have to try to change it, but maybe we could pull it off if needed.
(Yes, it looks like Guava should be able to move its own gwt-user
dependency to test
scope after removing support for GWT-RPC.)
Thank you for prompt response.
There is a truth-1.0-gwt.jar in Maven Central. Possibly "sub-artifact" is the wrong term here?
I missed that. I'm not sure the correct term though.
For the issue of GoogleCloudPlatform/cloud-opensource-java#980 , it turned out that Truth was not correctly setting scope:test for Truth. The static analysis tool already excludes test scope artifacts. So no need to change Truth for that issue.
If I move it to test scope, does that solve the problem?
Yes, that would prevent similar issues in future.
Thank you.