-
-
Notifications
You must be signed in to change notification settings - Fork 473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AmqpTarget doesn't find @PactVerifyProvider annotation #763
Comments
How are you running the test, from Maven or from your IDE? |
From both Gradle and the IDE. |
I took a deeper look. In Running my test from the IDE, the resolved URLs are: None of those JARs contains my classes. |
@uglyog did you have a chance to look into this? |
I've run a few, and they work for me in IntelliJ. Looks like you are getting an empty classpath, not your project's. Check your run configuration in IntelliJ to see what classpath is being set. The AmqpTarget is using |
@uglyog I still couldn't get it to work, even when overriding the I can get it to work when overriding the whole usage of Reflections (i.e. subclassing Instead of using a specific classloader, I simply use Why does |
The problem is that different build tools setup the classpaths in different ways. Pact-JVM also supports running verifications from Gradle, Maven, Leiningen and SBT. However, what we can do is default it to no classpath, and if it hasn't been overridden by one of the build plugins, then use the default. |
We run into the same problem. But in combination with pact-jvm-provider-junit5_2.12 and maven. |
The same problem with pact-jvm-provider-junit_2.12 version 3.6.1. |
@PMT87 @gumartinm You need to set the Maven Surefire plugin to use an isolated class loader. For example: <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin> |
@uglyog my test class setup is identical to the one @thombergs has and I am using pact-jvm-provider-junit_2.12 version 3.6.3 along with the suggested useSystemClassLoader configuration on surefire.
Any idea on what else I can do for this? |
@eranberg are you able to provide your POM file? |
@uglyog My project is meant to demonstrate how to use Pact with our existing technological stack and libraries so I am using both consumer and provider in the same project to represent the whole lifecycle of the testing environment.
|
@eranberg I was experiencing the same issue but with <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin> Intermediate versions may work, however I didn't look into it. |
Thanks @jon-ruckwood I will update the docs to specify that version as a minimum. |
@jon-ruckwood @uglyog
I still get the same error after all of these upgrades... |
@eranberg have a look at https://github.com/uglyog/pact-maven-amqp-test, it is a simple project that works with Maven 3.5. You'll need to compare it to yours to work out what the issue is. |
@uglyog Thanks for providing the github project with the testing samples. It worked out of the box for me. |
Had this issue as well. My issue is that I am using Java 11. Upgraded to |
Closing this as there looks like there are work arounds for all the issues |
I'm running a simple message provider test:
Executing this test results in
The cause for this is that the
Reflections
call inProviderVerifier#verifyResponseByInvokingProviderMethods
doesn't find the@PactVerifyProvider
annotation on my test method. There must be something wrong with the setup of theReflections
instance (class loader?).When I'm using the following code snippet from a test, the annotation is found:
The text was updated successfully, but these errors were encountered: