idea+springboot+maven项目集成kettle

近期项目中需要通过java对kettle进行任务调度和监控,所以学习一下kettle在java项目中的集成。本文章只作为个人记录使用,如没有解决各位的问题,谅解。

步骤:

  1. 在国内我们一般使用阿里云仓库作为maven的镜像仓库,但是kettle中有部分jar包阿里云仓库中没有,所以一般我们可以通过下载kettle的客户端程序,在其lib和libswt文件夹下获取,kettle客户端程序请自行下载所需版本

相关的jar包列表如下,可能有部分多余或遗漏,根据项目需要增加或删减

  1. 将相关的jar包文件,通过命令行窗口,使用mvn命令编译安装至本地maven库,注意修改-Dfile的值

mvn install:install-file -Dfile=E:\kettle\data-integration\lib\kettle-dbdialog-9.0.0.0-423.jar -DgroupId=pentaho-kettle -DartifactId=kettle-dbdialog -Dversion=9.0.0.0-423 -Dpackaging=jar

mvn install:install-file -Dfile=E:\kettle\data-integration\lib\kettle-core-9.0.0.0-423.jar -DgroupId=pentaho-kettle -DartifactId=kettle-core -Dversion=9.0.0.0-423 -Dpackaging=jar

mvn install:install-file -Dfile=E:\kettle\data-integration\lib\kettle-engine-9.0.0.0-423.jar -DgroupId=pentaho-kettle -DartifactId=kettle-engine -Dversion=9.0.0.0-423 -Dpackaging=jar

mvn install:install-file -Dfile=E:\kettle\data-integration\lib\metastore-9.0.0.0-423.jar -DgroupId=pentaho-kettle -DartifactId=metastore -Dversion=9.0.0.0-423 -Dpackaging=jar

  1. 配置pom.xml文件

可以现在properties标签中配置kettle版本号,方便后续使用

<properties>
        <parent-version>1.0.0</parent-version>
        <kettle.version>9.0.0.0-423</kettle.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.test.skip>true</maven.test.skip>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <springboot-javafx.version>2.1.6</springboot-javafx.version>
    </properties>
<!--&lt;!&ndash; kettle ETL 相关 start &ndash;&gt;-->
        <dependency>
            <groupId>pentaho-kettle</groupId>
            <artifactId>kettle-engine</artifactId>
            <version>${kettle.version}</version>
        </dependency>
        <dependency>
            <groupId>pentaho-kettle</groupId>
            <artifactId>metastore</artifactId>
            <version>${kettle.version}</version>
        </dependency>
        <dependency>
            <groupId>pentaho-kettle</groupId>
            <artifactId>kettle-core</artifactId>
            <version>${kettle.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>jug-lgpl</groupId>
                    <artifactId>jug-lgpl</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>secondstring</groupId>
                    <artifactId>secondstring</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
                <exclusion>
                    <artifactId>xercesImpl</artifactId>
                    <groupId>xerces</groupId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.xmlgraphics</groupId>
                    <artifactId>batik-js</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>pentaho-kettle</groupId>
            <artifactId>kettle-dbdialog</artifactId>
            <version>${kettle.version}</version>
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>19.0</version>
        </dependency>
        <dependency>
            <groupId>com.verhas</groupId>
            <artifactId>license3j</artifactId>
            <version>1.0.7</version>
        </dependency>
        <!-- kettle ETL 相关 end -->

4、配置好pom.xml文件后,重新加载xml文件,后续能否成功运行,本人尚未进行验证,可能会有部分报错,此处不再描述,后续待本人验证后重新编辑本文


版权声明:本文为weixin_40580131原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。