参考 https://blog.csdn.net/u013468915/article/details/82629810
https://blog.csdn.net/zougen/article/details/80825751
基于eclipse 和maven 本地安装已经安装好
1.将 maven conf/settings.xml整体修改为 <?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <proxies></proxies> <servers></servers> <mirrors></mirrors> <profiles> <profile> <id>pentaho</id> <activation> <activeByDefault>true</activeByDefault> </activation> <repositories> <repository> <id>pentaho-public</id> <name>Pentaho Public</name> <url>http://nexus.pentaho.org/content/groups/omni</url> <releases> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </releases> <snapshots> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>pentaho-public</id> <name>Pentaho Public</name> <url>http://nexus.pentaho.org/content/groups/omni</url> <releases> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </releases> <snapshots> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> <pluginGroups> <pluginGroup>org.pentaho.maven.plugins</pluginGroup> <pluginGroup>com.pentaho.maven.plugins</pluginGroup> <pluginGroup>com.github.spotbugs</pluginGroup> </pluginGroups> </settings> 2.到https://sourceforge.net/projects/pentaho/files/下载对应kettle版本的插件开发样本zip包kettle-sdk-plugin-assembly-8.2.0.0-342.zip a.将zip 解压出来kettle-sdk-plugin-assembly-8.2.0.0-342 b.将kettle-sdk-plugin-assembly-8.2.0.0-342/kettle-sdk-step-plugin通过existing maven projects 方式导入eclipse(下载驱动时间较长) c。Plugin execution not covered by lifecycle configuration: org.pentaho.maven.plugins:license-helper-maven-plugin:1.27:check-licens 解决c问题办法:在pom.xml build标签中添加如下元素 <pluginManagement> <plugins> <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.--> <plugin> <groupId>org.eclipse.m2e</groupId> <artifactId>lifecycle-mapping</artifactId> <version>1.0.0</version> <configuration> <lifecycleMappingMetadata> <pluginExecutions> <pluginExecution> <pluginExecutionFilter> <groupId> org.pentaho.maven.plugins </groupId> <artifactId> license-helper-maven-plugin </artifactId> <versionRange>[1.27,)</versionRange> <goals> <goal>check-license</goal> </goals> </pluginExecutionFilter> <action> <ignore></ignore> </action> </pluginExecution> <pluginExecution> <pluginExecutionFilter> <groupId> com.soebes.maven.plugins </groupId> <artifactId> iterator-maven-plugin </artifactId> <versionRange> [0.5.1,) </versionRange> <goals> <goal>iterator</goal> </goals> </pluginExecutionFilter> <action> <ignore></ignore> </action> </pluginExecution> </pluginExecutions> </lifecycleMappingMetadata> </configuration> </plugin> </plugins> </pluginManagement>
使用eclipse 调试kettle8.2源码 由于现在是maven管理分成多个小项目 尝试第一次将kettle 的ui项目 通过existing maven projects 方式导入eclipse 导入后项目名称为: kettle-ui-swt 找到spoon.java 使用run as java application 报错 java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: no swt-gtk-4623 in java.library.path no swt-gtk in java.library.path Can't load library: C:\Users\26110\.swt\lib\win32\x86_64\swt-gtk-4623.dll Can't load library: C:\Users\26110\.swt\lib\win32\x86_64\swt-gtk.dll
at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source) at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source) at org.eclipse.swt.internal.C.<clinit>(Unknown Source) at org.eclipse.swt.internal.Converter.wcsToMbcs(Unknown Source) at org.eclipse.swt.internal.Converter.wcsToMbcs(Unknown Source) at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source) at org.pentaho.di.ui.spoon.Spoon.main(Spoon.java:664) 解决办法: 修改pom.xml <dependencies> <dependency> <groupId>org.eclipse.swt</groupId> <artifactId>org.eclipse.swt.win32.win32.x86_64</artifactId> <version>4.3</version> </dependency> 这个依赖放在<dependencies> 第一位上 找到spoon.java 使用run as java application 报错 2019/10/31 14:29:41 - General - ERROR (version Unknown, build 0 from 2019/10/31 14:29:35.981 by 26110) : Error initializing transformation 2019/10/31 14:29:41 - General - ERROR (version Unknown, build 0 from 2019/10/31 14:29:35.981 by 26110) : org.pentaho.ui.xul.XulException: Can not locate Xul document [ui/spoon.xul] 2019/10/31 14:29:41 - General - at org.pentaho.ui.xul.impl.AbstractXulLoader.findDocument(AbstractXulLoader.java:512) 2019/10/31 14:29:41 - General - at org.pentaho.ui.xul.impl.AbstractXulLoader.loadXul(AbstractXulLoader.java:229) 2019/10/31 14:29:41 - General - at org.pentaho.di.ui.spoon.Spoon.init(Spoon.java:865) 2019/10/31 14:29:41 - General - at org.pentaho.di.ui.spoon.Spoon.createContents(Spoon.java:9142) 2019/10/31 14:29:41 - General - at org.eclipse.jface.window.Window.create(Window.java:426) 2019/10/31 14:29:41 - General - at org.eclipse.jface.window.Window.open(Window.java:785) 2019/10/31 14:29:41 - General - at org.pentaho.di.ui.spoon.Spoon.start(Spoon.java:9173) 2019/10/31 14:29:41 - General - at org.pentaho.di.ui.spoon.Spoon.main(Spoon.java:707) 2019/10/31 14:29:41 - General - ERROR (version Unknown, build 0 from 2019/10/31 14:29:35.981 by 26110) : Error starting Spoon shell 2019/10/31 14:29:41 - General - ERROR (version Unknown, build 0 from 2019/10/31 14:29:35.981 by 26110) : java.lang.NullPointerException 2019/10/31 14:29:41 - General - at org.pentaho.di.ui.spoon.Spoon.init(Spoon.java:918) 2019/10/31 14:29:41 - General - at org.pentaho.di.ui.spoon.Spoon.createContents(Spoon.java:9142) 2019/10/31 14:29:41 - General - at org.eclipse.jface.window.Window.create(Window.java:426) 2019/10/31 14:29:41 - General - at org.eclipse.jface.window.Window.open(Window.java:785) 2019/10/31 14:29:41 - General - at org.pentaho.di.ui.spoon.Spoon.start(Spoon.java:9173) 2019/10/31 14:29:41 - General - at org.pentaho.di.ui.spoon.Spoon.main(Spoon.java:707)
解决办法: 到https://sourceforge.net/projects/pentaho/files/Pentaho%208.2/client-tools/下载pdi-ce-8.2.0.0-342.zip(下载最大的1.2GB) 解压zip得到data-integration 将安装包data-integration\ui目录下的所有.xul和.properties文件拷贝到源码包…\kettle-ui-swt\src/main/resources\ui目录下即可解决,images文件夹不要复制覆盖
找到spoon.java 使用run as java application 报错 2019/10/31 14:43:09 - General - ERROR (version Unknown, build 0 from 2019/10/31 14:43:04.624 by 26110) : Error starting Spoon shell stopping 2019/10/31 14:43:09 - General - ERROR (version Unknown, build 0 from 2019/10/31 14:43:04.624 by 26110) : java.lang.NoClassDefFoundError: org/jaxen/JaxenException 2019/10/31 14:43:09 - General - at org.pentaho.ui.xul.impl.AbstractXulLoader.preProcess(AbstractXulLoader.java:357) 2019/10/31 14:43:09 - General - at org.pentaho.ui.xul.impl.AbstractXulLoader.loadXul(AbstractXulLoader.java:113) 2019/10/31 14:43:09 - General - at org.pentaho.ui.xul.swt.SwtXulLoader.loadXul(SwtXulLoader.java:128) 2019/10/31 14:43:09 - General - at org.pentaho.ui.xul.swt.SwtXulLoader.loadXul(SwtXulLoader.java:122) 2019/10/31 14:43:09 - General - at org.pentaho.ui.xul.impl.AbstractXulLoader.loadXul(AbstractXulLoader.java:239) 2019/10/31 14:43:09 - General - at org.pentaho.di.ui.spoon.Spoon.init(Spoon.java:865) 2019/10/31 14:43:09 - General - at org.pentaho.di.ui.spoon.Spoon.createContents(Spoon.java:9142) 2019/10/31 14:43:09 - General - at org.eclipse.jface.window.Window.create(Window.java:426) 2019/10/31 14:43:09 - General - at org.eclipse.jface.window.Window.open(Window.java:785) 2019/10/31 14:43:09 - General - at org.pentaho.di.ui.spoon.Spoon.start(Spoon.java:9173) 2019/10/31 14:43:09 - General - at org.pentaho.di.ui.spoon.Spoon.main(Spoon.java:707) 2019/10/31 14:43:09 - General - Caused by: java.lang.ClassNotFoundException: org.jaxen.JaxenException 2019/10/31 14:43:09 - General - at java.net.URLClassLoader.findClass(URLClassLoader.java:381) 2019/10/31 14:43:09 - General - at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 2019/10/31 14:43:09 - General - at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) 2019/10/31 14:43:09 - General - at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 2019/10/31 14:43:09 - General - ... 11 more
解决办法: 在pom.xml中引用此jar包即可解决 <dependency> <groupId>jaxen</groupId> <artifactId>jaxen</artifactId> <version>1.2.0</version> </dependency>
找到spoon.java 使用run as java application 报错 2019/10/31 14:53:38 - General - ERROR (version Unknown, build 0 from 2019/10/31 14:53:31.968 by 26110) : Error starting Spoon shell 2019/10/31 14:53:38 - General - ERROR (version Unknown, build 0 from 2019/10/31 14:53:31.968 by 26110) : java.lang.NullPointerException 2019/10/31 14:53:38 - General - at org.pentaho.di.ui.util.EnvironmentUtils.getUserAgent(EnvironmentUtils.java:86) 2019/10/31 14:53:38 - General - at org.pentaho.di.ui.util.EnvironmentUtils.isUnsupportedBrowserEnvironment(EnvironmentUtils.java:61) 2019/10/31 14:53:38 - General - at org.pentaho.di.ui.spoon.Spoon.checkEnvironment(Spoon.java:9097) 2019/10/31 14:53:38 - General - at org.pentaho.di.ui.spoon.Spoon.start(Spoon.java:9174) 2019/10/31 14:53:38 - General - at org.pentaho.di.ui.spoon.Spoon.main(Spoon.java:707) stopping
解决办法: 修改EnvironmentUtils.java类 protected String getUserAgent() { Browser browser; try { browser = new Browser( new Shell(), SWT.NONE ); } catch ( SWTError e ) { log.logError( "Could not open a browser", e ); return ""; } Object userAgentO = browser.evaluate( "return window.navigator.userAgent;" ); String userAgent = null; if(userAgentO != null) { userAgent = userAgentO.toString(); }else { userAgent = null; } browser.close(); return userAgent; } 到现在kettle-ui-swt就可以启动了 启动后如何连入插件的源码进行调试开发 将 kettle-ui-swt右键 ->build path->configure build path ->java build path->projects->add 将之前导入到eclipse中的kettle-sdk-step-plugin maven 项目添加到kettle-ui-swt项目中 kettle-ui-swt 项目中找到Spoon.java 右键 ->debug as ->debug configurations->arguments->VMArguments添加 -DKETTLE_PLUGIN_CLASSES=org.pentaho.di.sdk.samples.steps.demo.DemoStepMeta ->apply ->debug 至此 在打开的ui中的转换-》转换中就可以找到Demo Step 在DemoStepDialog中open方法添加断点便可进行调试