'How to use #pact maven plugin to verify a provider without port
Per https://docs.pact.io/implementation_guides/jvm/provider/maven/#2-define-the-pacts-between-your-consumers-and-providers : Protocol, Host, and Port are required.
My spring boot rest app is on kubernetes, I have endpoint URL like https://fruitbasket.net/abc
If I don't specify the port
tag, and run mvn pact:verify
; test fail and it seems like :8080
get appended during run time
https://fruitbasket.net/:8080/abc
Essentially, messing up the request endpoint.
Please note: I having fixed IP address and port isn't realistic.
How can I specify the provider host URL without port?
plugin config:
<plugin>
<groupId>au.com.dius.pact.provider</groupId>
<artifactId>maven</artifactId>
<version>4.1.0</version>
<configuration>
<serviceProviders>
<name>marketplace</name>
<protocol>https</protocol>
<host>fruitbasket.net</host>
</serviceProvider>
</serviceProviders>
</configuration>
</plugin>
Solution 1:[1]
in my current project we use this config
<plugin>
<groupId>au.com.dius.pact.provider</groupId>
<artifactId>maven</artifactId>
<version>4.2.0</version>
<configuration>
<pactBrokerUrl>https://mypactbroker</pactBrokerUrl>
<trimSnapshot>true</trimSnapshot>
</configuration>
</plugin>
with the annotation @PactBroker(scheme = "https")
on the test class.
Solution 2:[2]
The pom.xml is not correct. You are missing to open serviceProvider tag
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Ralf |
Solution 2 | Andreu Alcon |