Reputation: 4617
I have maven project Main and project Util.
Project Util depends on a third-party library Lib which depends on gwt-dev. gwt-dev causes a lot of conflicts, it is needed for GWT compilation only, so it should be marked as "provided", but it is "compile".
So I should mark Lib as "provided" in Util. But if I do so my Main project won't compile as it cannot find Lib classes.
At the moment I mark Lib as "provided" and then also include it as "provided" in Main. It is inconvenient because I have to remember Util dependencies.
How could I solve this problem?
Upvotes: 0
Views: 759
Reputation: 9245
Use Lib
in compile
scope and exclude gwt-dev:
<project>
...
<dependencies>
<dependency>
<groupId>Lib group</groupId>
<artifactId>Lib artifact id</artifactId>
<version>Lib version</version>
<scope>compile</scope>
<exclusions>
<exclusion> <!-- declare the exclusion here -->
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
Just a remark, excluding is typically a bad practice. In this case, you don't have much choice, since Lib
's artifact should have gwt-dev
as provided
(it's Lib
's bug...). So, don't forget to add a decent comment that explains the exclusion.
Upvotes: 1