I have built WireMock as a spring boot application using "spring-cloud-contract-wiremock" dependency. I have kept the mapping and _files inside src/test/resources folder.
When I run the application from IDE it works perfectly. But when I run the Jar directly it gives a fileNotFoundException.
<pre>java.lang.RuntimeException: java.io.FileNotFoundException: C:\Users\{user}\Downloads\src\test\resources\__files\....
My application.yml file contents :
spring:
main:
web-application-type: none
application:
name: wiremock-service
wiremock:
server:
files: classpath:/__files
stubs: classpath:/mappings
Main class :
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Bean
public Options wireMockOptions() throws IOException {
final WireMockConfiguration options = WireMockSpring.options();
//options.withRootDirectory("classpath*:");
options.port(9990);
return options;
}
}
How do I specify the path for _files and mappings so that I can run the independently from any location?