diff --git a/VIII. Build tool plugins/58.1. Including the plugin.md b/VIII. Build tool plugins/58.1. Including the plugin.md index e69de29..a8a7597 100644 --- a/VIII. Build tool plugins/58.1. Including the plugin.md +++ b/VIII. Build tool plugins/58.1. Including the plugin.md @@ -0,0 +1,52 @@ +### 58.1. 包含该插件 + +想要使用Spring Boot Maven插件只需简单地在你的pom.xml的`plugins`部分包含相应的XML: +```xml + + + 4.0.0 + + + + + org.springframework.boot + spring-boot-maven-plugin + 1.3.0.BUILD-SNAPSHOT + + + + repackage + + + + + + + +``` +该配置会在Maven生命周期的`package`阶段重新打包一个jar或war。下面的示例显示在`target`目录下既有重新打包后的jar,也有原始的jar: +```shell +$ mvn package +$ ls target/*.jar +target/myproject-1.0.0.jar target/myproject-1.0.0.jar.original +``` +如果不包含像上面那样的``,你可以自己运行该插件(但只有在package目标也被使用的情况)。例如: +```shell +$ mvn package spring-boot:repackage +$ ls target/*.jar +target/myproject-1.0.0.jar target/myproject-1.0.0.jar.original +``` +如果使用一个里程碑或快照版本,你还需要添加正确的pluginRepository元素: +```xml + + + spring-snapshots + http://repo.spring.io/snapshot + + + spring-milestones + http://repo.spring.io/milestone + + +```