Search code examples
javamavenpom.xmljbehaveserenity-bdd

Can't configure pom.xml for serenity+jbehave


I got these error while trying to perform:

mvn clean verify -Dwebdriver.driver=chrome

Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.4:enforce (verify) on project serenity-jbehave-showcase: org.apache.maven.plugins.enforcer.DependencyConvergence failed with message:
[ERROR] Failed while enforcing releasability the error(s) are [
[ERROR] Dependency convergence error for com.google.guava:guava:19.0 paths to dependency are:
[ERROR] +-net.serenitybdd.showcase:serenity-jbehave-showcase:0.0.1-SNAPSHOT
[ERROR] +-net.serenity-bdd:serenity-core:1.2.2
[ERROR] +-com.google.guava:guava:19.0
[ERROR] and
[ERROR] +-net.serenitybdd.showcase:serenity-jbehave-showcase:0.0.1-SNAPSHOT
[ERROR] +-net.serenity-bdd:serenity-core:1.2.2
[ERROR] +-net.serenity-bdd:serenity-report-resources:1.2.2
[ERROR] +-com.google.guava:guava:19.0
[ERROR] and

and etc.

What do I have to change in pom.xml to run my test just using mvn clean verify -Dwebdriver.driver=chrome?

My pom.xml is


Solution

  • The "and etc." you reference probably has some more relevant info. Going by what you have, though, this looks like you have multiple dependencies on guava, and not all of them are the same version. (Note that some of them may be transitive dependencies: those that are included as a dependency by another dependency).

    The maven-enforcer-plugin detects when a single library has multiple versions specified, and it breaks the build. If you're just trying to run a quick test, though, you can probably add -Denforcer.skip=true. This is not recommended for long-term use, but only for running your single test.

    Long-term, you will ultimately need to use Maven's dependencyManagement to force a specific version of Guava to be used, overriding the version mismatch.