LoginSignup
6
6

More than 5 years have passed since last update.

spring-boot-devtools をパッケージに含まれないようにする

Posted at

概要

spring-boot-devtools をそのまま利用すると、実行可能なjarにパッケージングした時に、spring-boot-devtools.jar が含まれてしまう。
含まれないようにする対応。

spring-boot-devtools の設定

多分こんな感じで設定してあると思われる。

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

パッケージに含まれないようにする

Spring Boot Maven Pluginでdevtoolsを除外するようにする。
具体的には excludeDevtoolstrue にする。

<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をjar -xf target/hoge.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

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6