spring boot web项目 maven 调用kettle

kettle的maven依赖没有找到,通过自己向maven库中添加,解决了springboot web项目调用kettle的问题

解决方法如下:

1.向maven中添加jar 

需要添加的jar包包括:kettle-core.jar,
kettle-engine.jar,metastore.jar,vfs2.jar, scannotation.jar

这些包在kettle的解压路径 pdi-ce-7.0.0.0-25\data-integration\lib 下可以找到

添加方法如下:

mvn install:install-file -Dfile=C:\ml\pdi-ce-7.0.0.0-25\data-integration\lib\commons-vfs2-2.1-20150824.jar -DgroupId=pentaho-kettle -DartifactId=vfs2 -Dversion=2.1-20150824 -Dpackaging=jar
mvn install:install-file -Dfile=C:\ml\pdi-ce-7.0.0.0-25\data-integration\lib\kettle-core-7.0.0.0-25.jar -DgroupId=pentaho-kettle -DartifactId=kettle-core -Dversion=7.0.0.0-25 -Dpackaging=jar
mvn install:install-file -Dfile=C:\ml\pdi-ce-7.0.0.0-25\data-integration\lib\kettle-engine-7.0.0.0-25.jar -DgroupId=pentaho-kettle -DartifactId=kettle-engine -Dversion=7.0.0.0-25 -Dpackaging=jar
mvn install:install-file -Dfile=C:\ml\pdi-ce-7.0.0.0-25\data-integration\lib\metastore-7.0.0.0-25.jar -DgroupId=pentaho-kettle -DartifactId=metastore -Dversion=7.0.0.0-25 -Dpackaging=jar
mvn install:install-file -Dfile=C:\ml\pdi-ce-7.0.0.0-25\data-integration\lib\scannotation-1.0.2.jar -DgroupId=pentaho-kettle -DartifactId=scannotation -Dversion=1.0.2 -Dpackaging=jar

C:\ml\pdi-ce-7.0.0.0-25\是我的kettle解压路径,这个命令可以通过cmd窗口执行

mvn命令需要添加环境变量,如果不添加,需要进入maven的bin目录执行

2. 在工程pom.xml中添加依赖

<dependency>
    <groupId>pentaho-kettle</groupId>
    <artifactId>kettle-core</artifactId>
    <version>7.0.0.0-25</version>
</dependency>
<dependency>
    <groupId>pentaho-kettle</groupId>
    <artifactId>kettle-engine</artifactId>
    <version>7.0.0.0-25</version>
</dependency>
<dependency>
    <groupId>pentaho-kettle</groupId>
    <artifactId>vfs2</artifactId>
    <version>2.1-20150824</version>
</dependency>
<dependency>
    <groupId>pentaho-kettle</groupId>
    <artifactId>metastore</artifactId>
    <version>7.0.0.0-25</version>
</dependency>
<dependency>
    <groupId>pentaho-kettle</groupId>
    <artifactId>scannotation</artifactId>
    <version>1.0.2</version>
</dependency>

3.依然报错

在工程中 添加如下测试代码

KettleEnvironment.init();
TransMeta tm = new TransMeta(filename);
Trans trans = new Trans(tm);
// 空参调用
trans.execute(null);
trans.waitUntilFinished();

在执行到KettleEnvironment.init()时, 依然报java.lang.NoClassDefFoundError: javassist/bytecode/ClassFile错误

4.终于可以成功执行了

再添加

<dependency>
    <groupId>org.javassist</groupId>
    <artifactId>javassist</artifactId>
    <version>3.20.0-GA</version>
</dependency>

这个依赖后,终于可以正常执行了

 

 

 

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值