1

i'm trying to publish a Pact-File to my Pact-Broker with maven-plugin this way (taken from github Pact-Project):

<build>
<plugins>
<plugin>
<groupId>au.com.dius</groupId>
<artifactId>pact-jvm-provider-maven_2.12</artifactId>
<version>3.5.11</version>
<configuration>
<pactDirectory>${project.build.directory}/pacts</pactDirectory>
<pactBrokerUrl>mybrokerurl.de</pactBrokerUrl>
<projectVersion>${project.version}</projectVersion>
<trimSnapshot>true</trimSnapshot> <!-- Defaults to false -->
</configuration>
</plugin>
</plugins>
</build>

If i try to execute the maven build with pact:publish, i get following error:

Failed to execute goal au.com.dius:pact-jvm-provider-maven_2.12:3.5.11:publish (default-cli) on project myproject-test: Execution default-cli of goal au.com.dius:pact-jvm-provider-maven_2.12:3.5.11:publish failed: A required class was missing while executing au.com.dius:pact-jvm-provider-maven_2.12:3.5.11:publish: kotlin.TypeCastException

Top of Stack-Trace:

Error injecting: au.com.dius.pact.provider.maven.PactPublishMojo
java.lang.NoClassDefFoundError: kotlin.TypeCastException
    at java.lang.J9VMInternals.prepareClassImpl(Native Method)

Pact-File Creation with a JUnit-Tests works fine, so I assumed i had the correct dependencies and required files in classpath.

What am I missing? It seems, the kotlin.TypeCastExeption-Class is in package

<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-runtime</artifactId>

so i tried to add the dependency (version 1.2.0) to my pom after i got this error - but this didn't help.

Does anyone know a solution for my problem?

J_A_X
  • 12,857
  • 1
  • 25
  • 31
Vegetto313
  • 11
  • 1
  • Are you trying to build the source for pact-jvm somehow? Could you post the rest of your pom.xml file? I need to try to reproduce this locally to figure out what's going on. – J_A_X Jan 31 '18 at 03:41

1 Answers1

0

I was also getting the same error. The workaround I have applied is to delete maven repository from local disk and rebuild the project. It has solved error for me.

g00glen00b
  • 41,995
  • 13
  • 95
  • 133