你的浏览器不支持canvas

牛马的一生不该是十四亿的重复,而应该是各有各的精彩。

springboot打包jar时复制配置文件,打包docker复制配置文件

Date: Author: codexu

本文章采用 知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议 进行许可。

springboot打包jar时复制配置文件

pom.xml配置

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.5</version>
    <executions>
        <execution>
            <id>copy-resources</id>
            <phase>package</phase>
            <goals>
                <goal>copy-resources</goal>
            </goals>
            <configuration>
            <encoding>UTF-8</encoding>
            <outputDirectory>${project.build.directory}</outputDirectory>
            <resources>
                <resource>
                    <directory>./src/main/resources</directory>
                    <includes>
                        <include>application.properties</include>
                    </includes>
                </resource>
            </resources>
        </configuration>
    </execution>
    </executions>
</plugin>

打包docker复制配置文件

pom.xml配置

<plugin>
    <groupId>com.spotify</groupId>
    <artifactId>docker-maven-plugin</artifactId>
    <version>0.4.13</version>
    <configuration>
        <imageName>${imageName}:${imageVersion}</imageName>
        <dockerDirectory>src/main/docker</dockerDirectory>
        <resources>
            <resource>
                <targetPath>/</targetPath>
                <directory>${project.build.directory}</directory>
                <include>${project.build.finalName}.jar</include>
            </resource>
            <resource>
                <targetPath>/</targetPath>
                <directory>${project.build.directory}</directory>
                <include>application.properties</include>
            </resource>
        </resources>
    </configuration>
</plugin>

对于本文内容有问题或建议的小伙伴,欢迎在文章底部留言交流讨论。