Hi all. We have around 20 projects, some of them b...
# pact-jvm
n
Hi all. We have around 20 projects, some of them being provider, some consumer, some both, using Pact V3. We are now looking into migrating everything to Pact V4 but we have noticed that as soon as we migrate the provider to V4, it will only understand V4 contracts, making it incompatible with existing ones. Is there a way to run the V3 to V4 transition in a seamless way that doesn’t require deleting existing contracts? Otherwise, is there a migration guide we can follow? Thanks!
m
My understanding is that a v4 provider should be able to understand all of the previous specs. What errors are you getting?
n
Hi, I think I might have written it the wrong way. Our problem is when the consumer has migrated to v4 but the provider is still in v3. Then, we get this error:
Copy code
16:26:30.174 [main] DEBUG au.com.dius.pact.provider.ProviderUtils - Pact source does not have a constructor with one argument of type Class

Unexpected character 'EOI(null)' at position '3', expecting '[DOT]'
	at com.github.zafarkhaja.semver.VersionParser.consumeNextCharacter(VersionParser.java:516)
	at com.github.zafarkhaja.semver.VersionParser.parseVersionCore(VersionParser.java:288)
	at com.github.zafarkhaja.semver.VersionParser.parseValidSemVer(VersionParser.java:255)
	at com.github.zafarkhaja.semver.VersionParser.parseValidSemVer(VersionParser.java:195)
	at com.github.zafarkhaja.semver.Version.valueOf(Version.java:265)
	at au.com.dius.pact.core.model.DefaultPactReader.loadPact(PactReader.kt:203)
	at au.com.dius.pact.core.model.DefaultPactReader.loadPact(PactReader.kt:198)
	at au.com.dius.pact.provider.junitsupport.loader.PactFolderLoader.load(PactFolderLoader.kt:29)
	at au.com.dius.pact.provider.junit5.PactVerificationInvocationContextProvider$resolvePactSources$$inlined$flatMap$lambda$1.invoke(PactJUnit5VerificationProvider.kt:82)
	at au.com.dius.pact.provider.junit5.PactVerificationInvocationContextProvider$resolvePactSources$$inlined$flatMap$lambda$1.invoke(PactJUnit5VerificationProvider.kt:39)
xa	at au.com.dius.pact.provider.junit5.PactVerificationInvocationContextProvider.resolvePactSources(PactJUnit5Verif
m
that could be it, albeit that error isn’t too helpful
Is there a V4 feature you’re after? If you’re on the latest version of the library (Pact-JVM) you need not use V4 of the pact spec (serialisation format and some additional features). If you want to use Plugins, some of the newer matchers or have Message Pact and HTTP Pacts in the same file, then they are decent reasons to move
n
Thanks for replying. We were looking into using the new Kotlin DSL for consumers, as it provides an easier to read syntax
👍 1
m
that makes sense too 🙂