1 year ago

#366044

test-img

Morris Town

How to package a spring boot project using spring data elastcsearch with maven without skiping test?

I'm putting together a spring boot project that uses spring boot elasticsearch, the plan is to package the project on my local machine as a .jar file, send it to my offsite server, and run it.

On my server, elasticsearch is set to accept connections via local network's ip addresses only (i.e. curl localhost:9200 won't work but curl 172.168.0.7:9200 does), which i'm not able to access on my local machine.

When i run the project, i set the elasticsearch uris in my yml files to localhost, and it works fine. But when i try to package the project with maven, it runs test, which then connects to 172.168.0.7:9200 and of course fails, leaving me with a failed message like can't connect to that address.

The workaround is to set maven to skip tests altogehter, but that does't seem to be the right way to do it.

What should i do so that i can package the project with test?

Did a little research and most of them were about unit test, but in my case i didn't write any test classes, don't have surefire, i'm just stuck in the process of packaging.

java

spring-boot

maven

spring-data-elasticsearch

spring-boot-maven-plugin

0 Answers

Your Answer

Accepted video resources