Home > front end >  Docker image creation for spring boot application which uses library in eclipse workspace
Docker image creation for spring boot application which uses library in eclipse workspace

Time:09-21

I am getting error while creating docker image for a spring boot microservice(XMDService) which is using local libraries (I have added the dependencies for these libraries in pom.xml file )

BUILD FAILURE Failed to execute goal on project XMDService: Could not resolve dependencies for project org.xtintech.xap:SimulatorXMDIService:jar:0.0.1-SNAPSHOT: T he following artifacts could not be resolved: org.xtintech.xal:xalservicesapi:jar:0.0.1 -SNAPSHOT, org.xtintech.xal:xalplatformlibraries:jar:0.0.1-SNAPSHOT, org.xtintech.xal :simulatorxmdiserviceapi:jar:0.0.1-SNAPSHOT, org.xtintech.xpl:loggingframework:jar:0.0. 1-SNAPSHOT, org.xtintech.xpl:platformapi:jar:0.0.1-SNAPSHOT: Could not find artifact org.xtintech.xal:xalservicesapi:jar:0.0.1-SNAPSHOT ->

       <java.version>11</java. Version>
       <spring-cloud. Version>2021.0.3</spring-cloud.version>
   </properties>
   <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>````

CodePudding user response:

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.

CodePudding user response:

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

<dependency>
    <artifactId>..</artifactId>
    <groupId>..</groupId>
    <scope>system</scope>
    <systemPath>${basedir}/lib/dependency.jar</systemPath>
</dependency>

Step to build dockerfile

  1. create a jar/war file by using maven
  2. copy the jar/war file to docker in dockerfile
  3. up to you
  • Related