spring boot maven plugin简介

Spring Boot Maven Plugin简介

在pom.xml中引入
<build>
  <plugins>
   <plugin>
            <groupId>org.springframework.boot</groupId> 
         <artifactId>spring-boot-maven-plugin</artifactId>
         <version>2.0.5.RELEASE</version>
            <executions>
             <execution>
              <goals>
                        <goal>repackage</goal> 
               </goals>
          <configuration>
              ...
          </configuration>
             </execution>
        </executions>
   </plugin>
  </plugins>
</build>

包含的goals

spring-boot:run

运行SpringBoot应用

spring-boot:repackage

将jar/war包重新包装成可执行。

使用 layout=NONE 可以将依赖打入jar包, 但非可执行jar包。

classifier

因为默认情况下, repackage将会替换原jar包, 故当项目被别的项目依赖时, 可添加classifier, 以做区分。

...
<configuration>
    <classifier>exec</classifier>
</configuration>
...

attach

将会生成可执行jar包和original包, 只有original会被installe和deployed(jar包名称不会带origina)l


<configuration>
  <attach>false</attach>
</configuration>
spring-boot:start and spring-boot:stop

在mvn integration-test阶段, 管理SpringBoot应用的生命周期。

分配随机端口

random port

跳过完整性测试

添加属性,用于configuration。

skip test

指定profle

如下激活了foo和bar的profile

<configuration>
  <profiles>
    <profile>foo</profile>
    <profile>bar</profile>
  </profiles>
</configuration>
spring-boot:build-info

基于当前maven项目生成build-info.propertie,可被Actuator使用。

spring-boot:help

展示关于spring-boot-maven-plugin的帮助信息.
如下所示

mvn spring-boot:help -Ddetail=true -Dgoal=<goal-name> 

参考

Spring Boot Maven Plugin


文章作者: the next page
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 the next page !
评论
 上一篇
proto buffer 学习 proto buffer 学习
简介protobuffer是与语言无关、与平台无关、可扩展的数据格式, 可用于数据通信及存储等, 比XML更小、更快、更简洁。 实战定义proto filesyntax = "proto3"; // this is request me
2019-11-14 the next page
下一篇 
python-菜鸟教程 python-菜鸟教程
语法 注释 以#开头, 或 ‘’’ 和 “””。 行与缩进 使用缩进来表示代码块, 同一个代码块的语句必须包含相同的缩进空格数。 缩进数的空格数不一致,会导致运行错误。 多行语句 语句很长,可以使用反斜杠\来实现多行语句。 total
2019-05-19 the next page
  目录