`
sillycat
  • 浏览: 2536046 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

SpringBoot and Maven Release Package

 
阅读更多
SpringBoot and Maven Release Package

Here is how the project release a tar.gz file for me including the scripts
Here is the important pom.xml parts
                <plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>deployment/release/assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<id>install-external</id>
<phase>clean</phase>
<configuration>
<file>${basedir}/lib/suitetalk-axis-proxy-v2017_2-1.0.0.jar</file>
<repositoryLayout>default</repositoryLayout>
<groupId>com.netsuitetalk</groupId>
<artifactId>suitetalk-axis-proxy</artifactId>
<version>v2017_2-1.0.0</version>
<packaging>jar</packaging>
<generatePom>true</generatePom>
</configuration>
<goals>
<goal>install-file</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
It uses this assembly.xml configuration file to control the output of the tar.gz file
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>bundle</id>
<formats>
<format>tar.gz</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<fileSets>
<!--  script  -->
        <fileSet>
            <directory>bin</directory>
            <includes>
                <include>*.sh</include>
            </includes>
            <fileMode>0755</fileMode>
            <outputDirectory>bin/</outputDirectory>
        </fileSet>
        <!-- config files -->
        <fileSet>
            <directory>src/main/resources</directory>
            <includes>
                <include>application*.yaml</include>
                <include>log4j2.xml</include>
            </includes>
            <fileMode>0644</fileMode>
            <outputDirectory>conf/</outputDirectory>
        </fileSet>
        <!--  executable jar -->
        <fileSet>
            <directory>${project.build.directory}</directory>
            <outputDirectory>lib/</outputDirectory>
            <includes>
                <include>${project.artifactId}-${project.version}.jar</include>
            </includes>
            <fileMode>0755</fileMode>
        </fileSet>
        <!--  logging  -->
        <fileSet>
            <outputDirectory>logs/</outputDirectory>
            <excludes><exclude>**/*</exclude></excludes>
        </fileSet>
    </fileSets>
</assembly>
Here are some simple examples for shell script
start.sh
#!/bin/sh -ex
nohup java -Djava.net.preferIPv4Stack=true \
-XX:MaxMetaspaceSize=256M -XX:+HeapDumpOnOutOfMemoryError \
-XX:HeapDumpPath="/tmp/dump_oom.hprof" \
-Dspring.config.location=file:./conf/application.yaml \
-Dlogging.config=file:./conf/log4j2.xml \
-jar ./lib/sillycatsuperball-1.0.0.jar > logs/sillycatsuperball.log 2>&1 &
stop.sh
#!/bin/sh -ex
PID=$(ps -ef | grep "sillycatsuperball" | grep -v grep | awk '{ print $2 }')
kill -9 ${PID}

References:
https://www.jianshu.com/p/3bd850fcb488
https://segmentfault.com/a/1190000017386408
https://www.cnblogs.com/littleatp/p/9278517.html


分享到:
评论

相关推荐

    springboot 基础简易实例, maven项目

    &lt;version&gt;2.1.4.RELEASE &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt; &lt;groupId&gt;com.example&lt;/groupId&gt; &lt;artifactId&gt;demo &lt;version&gt;0.0.1-SNAPSHOT &lt;name&gt;demo &lt;description&gt;Demo project for ...

    spring boot 框架搭建 maven项目

    &lt;version&gt;1.3.5.RELEASE ``` - **引入Starter**:通过引入特定的starter,例如`spring-boot-starter-web`,可以快速搭建Web应用的基础环境。 ```xml &lt;groupId&gt;org.springframework.boot &lt;artifactId&gt;...

    spring boot 1.3.5 release

    - 使用默认包(Using the “default” package):建议如何组织项目的包结构。 - 主应用类的位置(Locating the main application class):解释主类的放置位置。 - **配置类**(Configuration classes): - ...

    springboot环境搭建软件包.rar

    总结来说,通过“springboot环境搭建软件包.rar”,我们可以快速搭建一套完整的SpringBoot开发环境,包括安装JDK、Maven、Eclipse和Spring Boot CLI,然后创建并运行一个简单的SpringBoot项目,展示“Hello World”...

    创建springboot项目.doc

    &lt;version&gt;2.0.2.RELEASE ``` Step 6: 添加依赖 在 pom.xml 文件中添加 web 应用基本环境配置的依赖: ```xml &lt;!-- web 应用基本环境配置 --&gt; &lt;groupId&gt;org.springframework.boot &lt;artifactId&gt;spring-boot-...

    手写springboot教程pdf

    1. **依赖管理**:SpringBoot通过Maven或Gradle提供了一套标准的依赖管理方案,使得开发者可以方便地引入第三方库,并且这些库已经经过了版本兼容性的验证。 2. **自动配置**:SpringBoot会根据已有的依赖关系自动...

    详解用maven搭建springboot环境的方法

    详解用Maven搭建SpringBoot环境的方法 Maven是Java世界中最流行的项目管理工具之一,它可以帮助开发者快速构建和管理项目。SpringBoot是当前最流行的Java框架之一,它可以帮助开发者快速构建基于Spring的应用程序。...

    spring+maven整合

    我们可以使用JUnit和Mockito进行单元测试,同时Spring还提供了`@RunWith(SpringRunner.class)`和`@SpringBootTest`注解来进行集成测试。 至于文件`monitor`,这可能是监控或者日志相关的配置或代码,它可能涉及...

    使用maven将Java程序打包成exe文件并制作成Windows系统服务之springboot打包(一)项目代码

    配置完成后,运行`mvn package`命令,Maven会生成一个可执行的JAR文件。然后,我们可以用`exec-maven-plugin`将JAR包装成exe。但这个过程通常需要额外的工具,如`launch4j`,它允许我们将Java应用封装为Windows可...

    maven Springmvc 4.16 环境搭建

    &lt;version&gt;2.5.x.RELEASE&lt;/version&gt; &lt;!-- 查看最新Spring Boot版本 --&gt; &lt;type&gt;pom &lt;scope&gt;import &lt;groupId&gt;org.springframework.boot &lt;artifactId&gt;spring-boot-starter-web &lt;groupId&gt;org.spring...

    如何用Maven搭建一个SpringBoot工程

    搭建SpringBoot工程是每个开发者在接触...通过这个过程,你不仅了解了如何使用Maven搭建SpringBoot工程,还掌握了配置文件的编写、API接口的创建以及多实例的配置。这些基础知识对于后续的SpringBoot开发至关重要。

    springboot整合druid、mybatis连接gbase8s.doc

    然后,配置构建文件`build.gradle`,更新Spring Boot版本至2.1.11.RELEASE,并将Maven仓库地址更改为阿里云的仓库。此外,我们还需要添加MyBatis和Druid的依赖。特别注意,Gbase8s的JDBC驱动需要手动下载并放在项目...

    springboot PDF文档

    6. **简化部署**:通过 `mvn clean package` 命令将应用打包成可执行的 jar 包,然后使用 `java -jar target/*.jar` 命令运行应用。 #### Spring Boot 的自动配置原理 Spring Boot 自动配置的核心在于 `@SpringBoot...

    springboot项目发布到ubuntu服务器上

    1. **Maven 清理与打包命令**:`mvn clean package` - `clean`:清理项目构建时产生的临时文件。 - `package`:构建项目并创建可执行的 JAR 或 WAR 文件。 2. **Spring Boot Maven 插件配置**: ```xml ...

    springboot构建自己的starter.pdf

    package com.chhliu.springboot.starter.helloworld; import org.springframework.boot.context.properties.ConfigurationProperties; / * 描述:人员信息自动配置属性类 * * @author chhliu * 创建时间:2017...

    用IDEA搭建Springboot spring MVC Mybatis集成环境

    1. **打包项目**:使用Maven命令`mvn clean package`进行打包。 2. **启动应用**:运行`src/main/resources/application.properties`中的主类(通常包含`@SpringBootApplication`注解)。 至此,我们已经成功地使用...

    springboot构建自己的starter.docx

    // Getter and Setter 方法 } ``` - **`@ConfigurationProperties`**: 用于绑定配置文件中的属性值到特定的 Java 对象上。 - **`prefix` 属性**: 指定配置属性的前缀,便于在配置文件中引用。 #### 结合使用自动...

Global site tag (gtag.js) - Google Analytics