不要包含spring-boot-devtools在包中

简要介绍

当直接使用Spring Boot DevTools时,将其打包为可执行的jar文件时,会包含spring-boot-devtools.jar文件。为了避免这种情况,需要采取相应的处理措施。

Spring Boot开发工具的配置

我认为设置大概是这样的。

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
    </dependency>
</dependencies>

确保不包含在包装中

将Spring Boot Maven插件中的devtools排除掉。具体来说,设置excludeDevtools为true。

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <!-- excludeDevtoolsをtrueにする -->
                <excludeDevtools>true</excludeDevtools>
            </configuration>
        </plugin>
    </plugins>
</build>

确定

用mvn package命令打包完成后,通过jar -xf target/hoge.jar等命令解压jar文件。
确认在BOOT-INF/lib目录下没有spring-boot-devtools.jar文件。

请提供更多上下文或完整的句子,以便我可以为您进行准确的中文翻译。

http://docs.spring.io/spring-boot/docs/current/maven-plugin/repackage-mojo.html#excludeDevtools
http://docs.spring.io/spring-boot/docs/current/maven-plugin/examples/repackage-classifier.html
http://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-devtools.html

请将上述链接中的内容以中文进行释义,只需一个选项。

bannerAds