Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
9.0.0
-
None
Description
If I run mvn dependency:tree on this basic war pom:
<?xml version="1.0"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>test</groupId> <artifactId>test</artifactId> <packaging>war</packaging> <version>1.0</version> <dependencies> <dependency> <groupId>org.apache.wicket</groupId> <artifactId>wicket-core</artifactId> <version>9.0.0</version> <type>jar</type> <scope>compile</scope> </dependency> </dependencies> </project>
then the output is this:
[INFO] test:test:war:1.0 [INFO] \- org.apache.wicket:wicket-core:jar:9.0.0:compile [INFO] +- com.github.openjson:openjson:jar:1.0.12:compile [INFO] +- org.apache.wicket:wicket-request:jar:9.0.0:compile [INFO] +- org.apache.wicket:wicket-util:jar:9.0.0:compile [INFO] | +- commons-fileupload:commons-fileupload:jar:1.4:compile [INFO] | +- commons-io:commons-io:jar:2.6:compile [INFO] | +- org.apache.commons:commons-collections4:jar:4.4:compile [INFO] | \- org.junit.jupiter:junit-jupiter-engine:jar:5.6.2:compile [INFO] | +- org.apiguardian:apiguardian-api:jar:1.1.0:compile [INFO] | +- org.junit.platform:junit-platform-engine:jar:1.6.2:compile [INFO] | | +- org.opentest4j:opentest4j:jar:1.2.0:compile [INFO] | | \- org.junit.platform:junit-platform-commons:jar:1.6.2:compile [INFO] | \- org.junit.jupiter:junit-jupiter-api:jar:5.6.2:compile [INFO] +- org.danekja:jdk-serializable-functional:jar:1.9.0:compile [INFO] \- org.slf4j:slf4j-api:jar:1.7.25:compile
The org.junit.jupiter:junit-jupiter-engine:jar should not have compile scope, because it means that it will be included in war files that use wicket-core.
I believe this is caused by the fact that wicket-util overrides the scope of org.junit.jupiter:junit-jupiter-engine:jar and sets it to "compile". As far as I understand, overriding the <scope> stops a dependency from inheriting the <optional> element, after which the <optional> element will default to "false".
This can be solved by adding the <optional> element to org.junit.jupiter:junit-jupiter-engine:jar and setting it to "true" in wicket-util.
The wicket-examples war is not affected by this. I think this is because the wicket-examples war file itself inherits from wicket-parent, in which case I have no idea how it affects the scope/optional resolution Anyway, this is not representative of a typical war file, which would not inherit from wicket-parent.