Hello,
since an update I get the following warning:
[main] WARN au.com.dius.pact.provider.junit.InteractionRunner - Skipping publishing of verification results (pact.verifier.publishResults is not set to 'true')
As I found this #publishing-verification-results-to-a-pact-broker-version-354 I tried to set the property in the pom.xml in property-section, via the properties-maven-plugin and via command line (Dpact.verifier.publishResults=true), but nothing of that worked for me. I could not figure out how to set it to true.
Any ideas?
Edit: This may be a duplicate of: https://github.com/DiUS/pact-jvm/issues/538
As I use Annotations (@PactUrl) and there is no Annotation like PactBrokerUrl there may be another chance? I need an url like: "http://" + Constants.PACTBROKERHOST + ":" + Constants.PACTBROKERPORT + "/pacts/provider/" + PROVIDER + "/consumer/" + CONSUMER+ "/version/" + PACTVERSION
The JUnit tests run by the surefire Maven plugin. You need to get it to set the property, as per http://maven.apache.org/surefire/maven-surefire-plugin/examples/system-properties.html
The value of 'true' the verifier seeks is the string "true" rather than the boolean true (see ProviderVerifier.kt) (Possible enhancement? If so, I can work on that). So that is why the way you set it via the terminal failed. That being said, when setting the property with the surefire Maven plugin, <pact.verifier.publishResults>true</pact.verifier.publishResults> suffices.
Also, this enables publishing verification results to a Pact Broker. So even if you set it to true, it has no use without a broker.
JVM properties are always strings. How can you supply any other type of value?
I think I erred because of my general jvm unfamiliarity. Rather than setting the property through maven (which I do now), I initially set pact.verifier.publishResults to the boolean true programatically. So
Properties prop = System.getProperties();
prop.put("pact.verifier.publishResults", true);
System.setProperties(prop);
would not register as 'true', but this would:
prop.put("pact.verifier.publishResults", "true");
This is probably just my own fault.
Okay, this is what I have now:
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${mvn-surefire-plugin.version}</version>
<configuration>
<systemProperties>
<property>
<pact.verifier.publishResults>true</pact.verifier.publishResults>
</property>
</systemProperties>
</configuration>
</plugin>
...
This is working for me.
One of my problems was that I executed my test without maven.
You can close this thread now as my issue is solved. :)
Thank you all!
@DerKnecht According to your last comment:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemProperties>
<property>
<pact.verifier.publishResults>true</pact.verifier.publishResults>
</property>
</systemProperties>
<includes>
<include>**/*Test.java</include>
<include>**/*Tests.java</include>
<include>**/*TestCase.java</include>
<include>**/*Spec.java</include>
</includes>
</configuration>
</plugin>
That still not work for me. Could you please help me?
ublishing verification results to a Pact Broker. So even if you set it to true, it has no use without a broker.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemProperties>
<property>
<pact.verifier.publishResults>"true"</pact.verifier.publishResults>
</property>
</systemProperties>
<includes>
<include>**/*Test.java</include>
<include>**/*Tests.java</include>
<include>**/*TestCase.java</include>
<include>**/*Spec.java</include>
</includes>
</configuration>
</plugin>
This is my configuration but still not works no matter I change the value to 'true' or true or "true".
@Norman-else what version of Pact-JVM are you using?
Hi even I am also not able to publish the results after verifying . I am getting error as publish is not set to true.
I am using this pulgin
and my other dependency details are
Can anyone please help me on this. I am able to do the verification sucessfully. I want to publish my results into PACT BROKER back
I have used "true",ture,'true' nothing workedout for me :(
@Dattasaisukumar just check https://maven.apache.org/surefire/maven-surefire-plugin/examples/system-properties.html, systemProperties is deprecated and you should use systemPropertyVariables which has a different form.
Most helpful comment
I think I erred because of my general jvm unfamiliarity. Rather than setting the property through maven (which I do now), I initially set pact.verifier.publishResults to the boolean true programatically. So
would not register as 'true', but this would:
This is probably just my own fault.