I am getting error while creating docker image for a spring boot microservice(XMDService) which is using library in jfrog(I have added the dependencies for these libraries in pom.xml
file and repository also .)
I copied settings.xml to the current directory. And I am getting 401 Unauthorized error.
<java.version>11</java. Version>
<spring-cloud. Version>2021.0.3</spring-cloud.version>
</properties>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>maven2</name>
<url>https://repo.maven.apache.org/maven2</url>
</repository>
. <repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>xtgcentral</id>
<name>xtplatformlibraries-libs-release-local</name>
<url>https://xtintech.jfrog.io/artifactory/xtplatformlibraries-libs-release-local</url>
</repository>
.
.
<repositories>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.xtintech.xal</groupId>
<artifactId>xalservicesapi</artifactId>
<version>0.0.1-SNAPSHOT</version>`enter code here`
</dependency>
<dependency>
<groupId>org.xtintech.xal</groupId>
<artifactId>xalplatformlibraries</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.xtintech.xal</groupId>
<artifactId>simulatorxmdiserviceapi</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.xtintech.xpl</groupId>
<artifactId>loggingframework</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.xtintech.xpl</groupId>
<artifactId>platformapi</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
# syntax=docker/dockerfile:1
FROM eclipse-temurin:17-jre-jammy
COPY .mvn/ .mvn
COPY mvnw pom.xml ./
COPY mvnw settings.xml ./
RUN ./mvnw -s settings.xml dependency:resolve
COPY src ./src
CMD ["./mvnw", "spring-boot:run"]
2
Answers
If you use local libraries you should add copy statments to your dockerfile, in which you copy the needed libraries to the right place I guess.
Because your libraries do not exist in any maven repository so when installing maven cannot recornize it..
The simply solution is that copy your libraries into a folder and then add them to maven like below
Step to build dockerfile