使用provisio-maven-plugin+ airlift launcher 开发类似trino 的运行包

如果运行过trino 或者presto 会发现比较方便,配置放的特别清晰,而且包含了方便的cli 工具,实际上trino 或者presto 内部也是基于了
provisio-maven-plugin+ airlift launcher 进行软件包处理的

参考打包配置

参考项目可以与阅读trino 或者下边链接我提供的github 地址

  • pom.xml
 
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.dalong</groupId>
        <artifactId>mywebapp-airlift</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>
 
    <artifactId>package</artifactId>
 
    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <dependencies>
        <dependency>
            <groupId>com.dalong</groupId>
            <artifactId>app</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
    </dependencies>
    <repositories>
        <repository>
            <id>maven</id>
            <url>https://repo1.maven.org/maven2/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <releases>
                <enabled>true</enabled>
            </releases>
        </repository>
    </repositories>
    <build>
        <plugins>
            <plugin>
                <groupId>ca.vanzyl.provisio.maven.plugins</groupId>
                <artifactId>provisio-maven-plugin</artifactId>
                <version>1.0.19</version>
                <executions>
                    <execution>
                        <id>unpack</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>provision</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
 
</project>
  • provision 插件配置
<runtime>
    <!-- Target -->
    <archive name="${project.artifactId}-${project.version}.tar.gz" hardLinkIncludes="**/*.jar" />
 
    <!-- Launcher --> // 此处就是利用airlift launcher 进行运行处理的,比较方便
    <artifactSet to="/bin">
        <artifact id="io.airlift:launcher:tar.gz:bin:223">
            <unpack />
        </artifact>
        <artifact id="io.airlift:launcher:tar.gz:properties:223">
            <unpack filter="true" />
        </artifact>
    </artifactSet>
 
    <fileSet to="/etc">
        <directory path="${basedir}/src/etc"/>
    </fileSet>
    <!-- Server -->
    <artifactSet to="lib">
        <artifact id="${project.groupId}:app:${project.version}" />
    </artifactSet>
 
</runtime>

配置文件(注意如下几个配置文件是必须的,否则启动会提示错误,具体python 脚本会有检查)

 

 

打包效果

可以看出打包的软件包还是很专业的,就和trnio 启动的模式是一样的

 

 

说明

对于单体项目打包基于provisio-maven-plugin+ airlift launcher 是一个不错的玩法,当然spring boot 项目自带的打包模式也是特别方便的,dremio 是基于了assembly 插件打包的,运行部分自己写了脚本

参考资料

core/trino-server/src/main/provisio/trino.xml
https://github.com/jvanzyl/provisio
https://trino.io/docs/current/installation/deployment.html
https://github.com/rongfengliang/airlift-learning

posted on   荣锋亮  阅读(208)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2022-01-27 升级版本的dremio cratedb arp 开发
2022-01-27 dremio arp 开发值得参考的链接
2022-01-27 dremio 链接starrocks 的方法
2021-01-27 cube.js 上下文变量
2021-01-27 cube.js 多租户的实践
2019-01-27 sofa graphql 2 rest api webhook 试用
2019-01-27 sofa graphql 2 rest api 试用

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示