首页 > 其他分享 >使用provisio-maven-plugin+ airlift launcher 开发类似trino 的运行包

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

时间:2023-01-27 20:55:39浏览次数:86  
标签:provisio plugin launcher airlift maven 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

标签:provisio,plugin,launcher,airlift,maven,trino
From: https://www.cnblogs.com/rongfengliang/p/17069309.html

相关文章