美文网首页
springboot打包复用lib

springboot打包复用lib

作者: Mracale | 来源:发表于2024-09-24 15:44 被阅读0次

    修改pom.xml文件

    <!-- 打包插件 -->
        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <configuration>
                        <mainClass>com.demo.HelloMailAppliation</mainClass>
                        <layout>ZIP</layout>
                        <!-- 注释后和依赖包一起打包 取消注释则不打包依赖-->
                        <includes>
                            <include>
                                <groupId>nothing</groupId>
                                <artifactId>nothing</artifactId>
                            </include>
                        </includes>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>repackage</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    

    Dockerfile

    FROM bladex/alpine-java:openjdk8-openj9_cn_slim
    
    MAINTAINER abc@abc.com
    
    WORKDIR /app
    
    COPY libs/ ./libs/
    
    COPY ./new.jar ./app.jar
    
    ENTRYPOINT ["java","-jar","-Djava.security.egd=file:/dev/./urandom","-Dloader.path=/app/libs","app.jar"]
    
    CMD ["--spring.profiles.active-dev"]
    
    
    

    常用命令:

    查看所有的镜像镜像
    docker images
    查看所有的容器信息
    docker ps -a
    

    相关文章

      网友评论

          本文标题:springboot打包复用lib

          本文链接:https://www.haomeiwen.com/subject/fweqrjtx.html