Maven/Docker: cache all dependencies

前端 未结 1 662
轻奢々
轻奢々 2021-01-06 05:03

I\'m trying to build/deploy a spring boot in a docker container.

FROM maven:3.5.3-jdk-8-slim AS build
COPY ./pom.xml /app/pom.xml
RUN cd /app
RUN mvn -f /app         


        
相关标签:
1条回答
  • 2021-01-06 05:35

    I finally find the solution by using go-offline-maven-plugin.

             <plugin>
                <groupId>de.qaware.maven</groupId>
                <artifactId>go-offline-maven-plugin</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <dynamicDependencies>
                        <DynamicDependency>
                            <groupId>org.apache.maven.surefire</groupId>
                            <artifactId>surefire-junit4</artifactId>
                            <version>2.20.1</version>
                            <repositoryType>PLUGIN</repositoryType>
                        </DynamicDependency>
                    </dynamicDependencies>
                </configuration>
            </plugin>
    

    And trying to get all dependencies using:

    mvn de.qaware.maven:go-offline-maven-plugin:resolve-dependencies
    
    0 讨论(0)
提交回复
热议问题