hi
i have a spring boot project with maven. i create a maven repository server and my project download repository from that. when i build and run project with docker it can download the dependency from custom server and custom maven settings.xml but when i user docker compose it can not download the repository .
DockerFile :
ENTRYPOINT uses the -s parameter without an absolute path inside the workdir app
compose file
you do mount the host folder /root/.m2 into the container path /root/.m2, as such the settings.xml that exists inside the image is will become invisible inside the container. A bind mounts a host folder on top of a container folder making its original content (it has from the image) inacessible.
Since you have another copy of settings.xml in /usr/share/maven/ref/, it should work if you replace your -s setting with -s /usr/share/maven/ref/settings.xml
To use the settings.xml from /root/.m2, you will have to replace the bind with a ārealā volume - or simply do not bind a host folder into that container folder.
Update: I had a mixup of wording snippets in the post which I removed again.
Downloading from yasan:"my custom url"/org/springframework/boot/spring-boot-starter-parent/2.3.3.RELEASE/spring-boot-starter-parent-2.3.3.RELEASE.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for com.example:demo:1.0.0: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.3.3.RELEASE from/to yasan ("my custom url"): transfer failed for "my custom url"/org/springframework/boot/spring-boot-starter-parent/2.3.3.RELEASE/spring-boot-starter-parent-2.3.3.RELEASE.pom and 'parent.relativePath' points at no local POM @ line 5, column 10
i have a settings.xml in root folder. i send this dockerfile and docker-compose setting for show that i try multiple setting but i have same error in docker-compose up --build but not in docker build/run
Your problem is either that the settings.xml is not used, has an incomplete configuration or you suffer from āinconsitentā files. To combat the inconsitant file situation, make sure to add --strict-checksums to your mvn command.
@alirezatali can you please put in your own words what you understood from my previous post? I just want to be sure you actualy put it into consideration when posting your responses.
but i has error again. and my question is why this worked with docker but can not work with docker-compose? and i must doing somthing in docker network?
Then you may be right with the network if your āparent POMā comes from the internet. If that is possible. I am not very familier with Maven.
Try to check your docker network using curl in the same network you run maven. If your user defined network created by Docker compose is blocked or colliding with another network that can be the issue.