I have a problem about running docker-compose.yml in my Spring Boot Microservices.
In my project directory, I run this command (docker-compose up -d)
When docker tries to build report service, I get an issue.
I added advertisement service into report service before.
Here is my error shown below.
Failed to execute goal on project report: Could not resolve dependencies for project com.springbootmicroservices:report:jar:0.0.1-SNAPSHOT: Could not find artifact co
m.springbootmicroservices:advertisement:jar:0.0.1-SNAPSHOT -> [Help 1]
Have you tried to run ls or find commands to investigate the issue before executing the build in the Dockerfile? Since Docker would not magically remove files, if the builder can’t find it, it is not where you expect it to be.
I expected to see a Docker image in a registry or a Dockerfile. That screenshot does not really say more about the issue than your quoted error message. If you could share your Dockerfile, that would be more useful, but since you know better what to expect, you could find out if your files are where you want those to be. If not, then we can try to help you find out why and how you should change your Dockerfile if you can share that.
Instead of adding new RUN instructions to the Dockerfile before the build, you could also remove everything after copying the required files, run the container from that image, and run the build manually in an interactive way.
You want to perform maven builds during image build and dependencies are missing.
It seems that you want to pre-fetch the dependencies from inside the build container - in order to do that it must have the settings.xml to actualy know how to acces your maven repository. But it also looks like you try to pre-fetch dependencis in the .mvn folder, which I couldn’t see anywhere.
Of course this looks fine in intellij, as you high likely use mvn install ... to build and install the build jar files into your host’s local .m2 (usualy in ~/.m2) artifact cache folder. A container is not able to see or use artifacts and the settings.xml from that folder.
You are right, I missed the compose file in the project root, but I would need to figure out which compose service is the failing one, and yes, you mentioned “report service”, which could have been anything to me, and yes, you shared the picture which actually shows the failing service is “reportservice” without space. It is better when you explain in your post what you did in details, but it seems @meyay understood you, so you are in good hands
After I ran mvn install, I see jar file under test folder of each service. I also revised Dockerfile of all services and I updated my repository.
I still got the same error in report service.
Failed to execute goal on project report: Could not resolve dependencies for project com.springbootmicroservices:report:jar:0.0.1-SNAPSHOT: Could not find artifact co
m.springbootmicroservices:advertisement:jar:0.0.1-SNAPSHOT
I still got the same error in report service. I cannot fix it.
Failed to execute goal on project report: Could not resolve dependencies for project com.springbootmicroservices:report:jar:0.0.1-SNAPSHOT: Could not find artifact co
m.springbootmicroservices:advertisement:jar:0.0.1-SNAPSHOT
If you don’t give us any new information and don’t respond to our comments just ask the same question, we can’t help. Did you understand what @meyay wrote to you?
I don’t see that you mentioned it after meyay’s post.
When you look at pom.xml of report service, you notice that advertisement dependency is added in there. I think it is the issue.
I use RabbitMQ from advertisement service to report service and I don’t create a dto for advertisement in report service.
How can I revise Dockerfile of report service if possible?
I revised some codes in my project.
I got healthcheck configuration issue.
I updated my repository.
Here are my errors shown below.
ERROR: for advertisementservice Service "database" is missing a healthcheck configuration
ERROR: for reportservice Service "database" is missing a healthcheck configuration
ERROR: for userservice Service "database" is missing a healthcheck configuration
``` How can I fix it?
pom.xml is not settings.xml My Java experience is not recent, so I could just refer to what meyay wrote, but I will not quote again. If you think that settings.xml would not help you, then explain why so you can get new responses suggesting other solutions or explaining why you are wrong. If you are ignoring suggestions, because you don’t understand it, you will not get new reactions, so ask back.
But there are suggestions. Just because there is no accepted answer, it doesn’t mean the suggestions were not good. In fact, those are suggesting something similar to what meyay suggested, so he was probably right.
I appreciate your shared error messages, but I would not check your changelog / commit messages every time you change something, so please, always share the relevant part of the code too or share a link to the diff, so we can check it faster and tell you why the change caused the new error. However it is not related to your previous issue. You simply need to have a healtcheck if you want a container to depend on an other containers health.
Please don’t post links to images. The forum software removed your posts thinking it was spam. Also, it invalidates the posts for future readers when the links go dead.
Even more, please don’t use images to post text. Just copy the text and format it.