Hi, I'm trying to run tests for my provider follow...
# pact-jvm
w
Hi, I'm trying to run tests for my provider following https://docs.pact.io/implementation_guides/jvm/provider/junit5spring I added the dependency
Copy code
<dependency>
            <groupId>au.com.dius.pact.provider</groupId>
            <artifactId>junit5spring</artifactId>
            <version>4.6.10</version>
            <scope>test</scope>
        </dependency>
and started
mvn clean tests
I tried also with version 4.6.17 but still getting errors like
Copy code
package au.com.dius.pact.provider.junit5spring does not exist
[ERROR] /Users/MY_PATH/ProviderContractVerificationTest.java:[8,2] cannot find symbol
[ERROR]   symbol: class Provider
[ERROR] /Users/MY_PATH/ProviderContractVerificationTest.java:[9,2] cannot find symbol
[ERROR]   symbol: class PactBroker
[ERROR] /Users/MY_PATH/ProviderContractVerificationTest.java:[15,17] cannot find symbol
[ERROR]   symbol:   class PactVerificationContext
[ERROR]   location: class ProviderContractVerificationTest
[ERROR] /Users/MY_PATH/ProviderContractVerificationTest.java:[21,39] cannot find symbol
[ERROR]   symbol:   class PactVerificationContext
[ERROR]   location: class ProviderContractVerificationTest
[ERROR] /Users/MY_PATH/ProviderContractVerificationTest.java:[7,13] cannot find symbol
[ERROR]   symbol: class SpringExtension
[ERROR] /Users/MY_PATH/ProviderContractVerificationTest.java:[20,17] cannot find symbol
[ERROR]   symbol:   class PactVerificationInvocationContextProvider
[ERROR]   location: class ProviderContractVerificationTest
I've also checked in my .m2 for the artifact
Copy code
❯ ls ~/.m2/repository/au/com/dius/pact/provider/
4.6.10       4.6.17       junit5       junit5spring
❯ ls ~/.m2/repository/au/com/dius/pact/provider/junit5spring
4.6.10 4.6.17
❯ ls ~/.m2/repository/au/com/dius/pact/provider/junit5spring/4.6.10
_remote.repositories         junit5spring-4.6.10.jar      junit5spring-4.6.10.jar.sha1 junit5spring-4.6.10.pom      junit5spring-4.6.10.pom.sha1
I tried with both junit5 and junit5spring. Do you have any advices for that?
r
Your dependency resolution is broken. au.com.dius.pact.provider.junit5spring depends on au.com.dius.pact.provider.junit5 (https://central.sonatype.com/artifact/au.com.dius.pact.provider/junit5spring/4.6.17/dependencies) au.com.dius.pact.provider.junit5 depends on au.com.dius.pact.core.model (https://central.sonatype.com/artifact/au.com.dius.pact.provider/junit5/4.6.17/dependencies) au.com.dius.pact.core.model contains some of those classes.
w
I tried to refresh that resolution with
Copy code
mvn clean
mvn dependency:purge-local-repository
mvn dependency:resolve -U
but it still seems to be broken. Do you maybe have any ideas how to fix that?
Copy code
[INFO] \- au.com.dius.pact.provider:junit5:jar:4.6.17:test
[INFO]    +- au.com.dius.pact:provider:jar:4.6.17:test
[INFO]    |  +- au.com.dius.pact.core:matchers:jar:4.6.17:test
[INFO]    |  |  +- io.github.java-diff-utils:java-diff-utils:jar:4.12:test
[INFO]    |  |  +- org.atteo:evo-inflector:jar:1.3:test
[INFO]    |  |  \- com.github.zafarkhaja:java-semver:jar:0.9.0:test
[INFO]    |  +- org.apache.httpcomponents.client5:httpclient5:jar:5.1.4:test
[INFO]    |  |  +- org.apache.httpcomponents.core5:httpcore5:jar:5.1.5:test
[INFO]    |  |  \- org.apache.httpcomponents.core5:httpcore5-h2:jar:5.1.5:test
[INFO]    |  +- io.github.classgraph:classgraph:jar:4.8.129:test
[INFO]    |  +- org.apache.commons:commons-collections4:jar:4.4:test
[INFO]    |  +- com.github.ajalt:mordant:jar:1.2.1:test
[INFO]    |  |  \- com.github.ajalt:colormath:jar:1.2.0:test
[INFO]    |  +- com.vladsch.flexmark:flexmark:jar:0.62.2:test
[INFO]    |  |  +- com.vladsch.flexmark:flexmark-util-ast:jar:0.62.2:test
[INFO]    |  |  +- com.vladsch.flexmark:flexmark-util-builder:jar:0.62.2:test
[INFO]    |  |  +- com.vladsch.flexmark:flexmark-util-collection:jar:0.62.2:test
[INFO]    |  |  +- com.vladsch.flexmark:flexmark-util-data:jar:0.62.2:test
[INFO]    |  |  +- com.vladsch.flexmark:flexmark-util-dependency:jar:0.62.2:test
[INFO]    |  |  +- com.vladsch.flexmark:flexmark-util-format:jar:0.62.2:test
[INFO]    |  |  +- com.vladsch.flexmark:flexmark-util-html:jar:0.62.2:test
[INFO]    |  |  +- com.vladsch.flexmark:flexmark-util-misc:jar:0.62.2:test
[INFO]    |  |  +- com.vladsch.flexmark:flexmark-util-sequence:jar:0.62.2:test
[INFO]    |  |  \- com.vladsch.flexmark:flexmark-util-visitor:jar:0.62.2:test
[INFO]    |  \- com.vladsch.flexmark:flexmark-ext-tables:jar:0.62.2:test
[INFO]    |     \- com.vladsch.flexmark:flexmark-util:jar:0.62.2:test
[INFO]    |        \- com.vladsch.flexmark:flexmark-util-options:jar:0.62.2:test
[INFO]    +- au.com.dius.pact.core:support:jar:4.6.17:test
[INFO]    |  +- io.github.oshai:kotlin-logging-jvm:jar:5.1.4:test
[INFO]    |  +- org.apache.httpcomponents.client5:httpclient5-fluent:jar:5.1.4:test
[INFO]    |  +- org.apache.commons:commons-text:jar:1.10.0:test
[INFO]    |  \- com.github.mifmif:generex:jar:1.0.2:test
[INFO]    |     \- dk.brics.automaton:automaton:jar:1.11-8:test
[INFO]    +- au.com.dius.pact.core:pactbroker:jar:4.6.17:test
[INFO]    |  \- com.google.guava:guava:jar:20.0:test
[INFO]    +- au.com.dius.pact.core:model:jar:4.6.17:test
[INFO]    |  +- org.apache.tika:tika-core:jar:2.9.1:test
[INFO]    |  +- javax.mail:mail:jar:1.5.0-b01:test
[INFO]    |  |  \- javax.activation:activation:jar:1.1:test
[INFO]    |  +- io.ktor:ktor-http-jvm:jar:2.3.8:test
[INFO]    |  |  +- org.jetbrains.kotlin:kotlin-stdlib-jdk7:jar:1.6.21:test
[INFO]    |  |  +- org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:jar:1.6.4:test
[INFO]    |  |  +- org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:jar:1.6.4:test
[INFO]    |  |  \- io.ktor:ktor-utils-jvm:jar:2.3.8:test
[INFO]    |  |     \- io.ktor:ktor-io-jvm:jar:2.3.8:test
[INFO]    |  \- commons-beanutils:commons-beanutils:jar:1.9.4:test
[INFO]    |     +- commons-logging:commons-logging:jar:1.2:test
[INFO]    |     \- commons-collections:commons-collections:jar:3.2.2:test
[INFO]    +- org.junit.jupiter:junit-jupiter-api:jar:5.8.2:test
[INFO]
I also checked the dependencies tree
I finally solved that. For future readers my current config: pom.xml
Copy code
<dependency>
            <groupId>au.com.dius.pact.provider</groupId>
            <artifactId>junit5</artifactId>
            <version>4.6.17</version>
        </dependency>
        <dependency>
            <groupId>au.com.dius.pact.provider</groupId>
            <artifactId>junit5spring</artifactId>
            <version>4.6.17</version>
        </dependency>
        <dependency>
            <groupId>au.com.dius.pact.provider</groupId>
            <artifactId>junit</artifactId>
            <version>4.6.17</version>
        </dependency>
imports:
Copy code
import au.com.dius.pact.provider.junitsupport.Provider;
import au.com.dius.pact.provider.junitsupport.loader.PactBroker;
import au.com.dius.pact.provider.junit5.PactVerificationContext;
import au.com.dius.pact.provider.junit5.PactVerificationInvocationContextProvider;