I opened this issue on Jira but that was not the good place so I will talk about it here.
Upgrading from 10.11.9 to 12.10.3 and I have an enforcer issue.
In my pom I have
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
<scope>test</scope>
</dependency>
[INFO] — maven-enforcer-plugin:1.4.1:enforce (enforce-jakarta.xml.bind-api) @ xwiki-ext-collab —
[WARNING] Rule 0: org.apache.maven.plugins.enforcer.BannedDependencies failed with message:
XWiki uses jakarta.xml.bind:jakarta.xml.bind-api instead
Found Banned Dependency: javax.xml.bind:jaxb-api:jar:2.3.1
I found where I use jaxb, it’s for my JUnit test with Mockito runner
I run my test with @RunWith(MockitoJUnitRunner.class)
I’m not sure why but -Dxwiki.enforcer.skip
doesn’t skip the plugin actually … Do you know How could I still use my mockito runner or how to ignore this enforcer error ?
Thanks
Why ignore it ? The enforcer error is quite clear, and you can avoid it by just using jakarta.xml.bind:jakarta.xml.bind-api
instead of javax.xml.bind:jaxb-api
in your pom. It’s the same thing, just a different id.
Thanks for fast answer.
Unfortunatelly I already tried that and then I have a lot of different error all leading to JUnit not happy about this change
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<scope>test</scope>
</dependency>
Failed while enforcing RequireUpperBoundDeps. The error(s) are [
Require upper bound dependencies error for org.junit.jupiter:junit-jupiter-api:5.1.1 paths to dependency are:
±eu.hbp.wiki:xwiki-ext-collab:0.23.3
±org.mockito:mockito-junit-jupiter:2.23.4
±org.junit.jupiter:junit-jupiter-api:5.1.1
and
±eu.hbp.wiki:xwiki-ext-collab:0.23.3
±org.junit.jupiter:junit-jupiter-params:5.1.1
±org.junit.jupiter:junit-jupiter-api:5.1.1
and
±eu.hbp.wiki:xwiki-ext-collab:0.23.3
±org.xwiki.commons:xwiki-commons-tool-test-component:12.10
±org.xwiki.commons:xwiki-commons-tool-test-simple:12.10
±org.junit.jupiter:junit-jupiter:5.7.0
±org.junit.jupiter:junit-jupiter-api:5.7.0
and
±eu.hbp.wiki:xwiki-ext-collab:0.23.3
±org.xwiki.commons:xwiki-commons-tool-test-component:12.10
±org.xwiki.commons:xwiki-commons-tool-test-simple:12.10
±org.junit.jupiter:junit-jupiter:5.7.0
±org.junit.jupiter:junit-jupiter-engine:5.7.0
±org.junit.jupiter:junit-jupiter-api:5.7.0
,
Actually what you get here is simply a totally different error which you did not get before because it’s checked after the other one probably.
So what this new error is telling you is that based on the order of your dependencies you will end up with the version 5.1.1 of junit-jupiter-api while some of your dependencies expect to get version 5.7.0. It’s because the first one found wins in Maven and that’s the one coming from your mockito-junit-jupiter dependency.
You should be able to fix that on your side by simply removing your dependency on mockito-junit-jupiter (xwiki-commons-tool-test-component is getting that for you already) and I will add a new dependency management for junit-jupiter-api in XWiki Commons to avoid this kind of issue in the future.