1. 程式人生 > >Pentaho Data Integration (Kettle) step外掛開發

Pentaho Data Integration (Kettle) step外掛開發

一,開發環境搭建


1,kettle原始碼 
因為kettle開發文件支援有限,所以必須有一份原始碼備查。原始碼地址: 
https://github.com/pentaho/pentaho-kettle 
選擇9.0版本,下載zip 
kettle需要jdk 1.8以上版本,maven3.0以上版本,並且在maven的conf/settings.xml中新增以下配置:

<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>

eclipse版本最好是oxygen,下載程式碼後解壓,在eclipse中import project,選擇import maven專案,import好之後,一般會報錯:

Plugin execution not covered by lifecycle configuration:

解決方法是在F2裡選在eclipse全域性設定級別ignore掉這個外掛,這不會影響後續編譯。

之後再mvn clean install –skipTest 
最終編譯好的目標檔案在工程目錄\assemblies\client\target\pdi-ce-xxxx 
解壓這個zip,執行Spoon.bat就可以啟動自己編譯的kettle了

二,外掛開發準備


外掛開發相關文件在這裡: 

https://help.pentaho.com/Documentation/8.1/Developer_Center/PDI/Extend 
我就不翻譯了

kettle可以開發的外掛有幾種,我們這裡只講 step plugin的開發 
首先在SourceForge上下載kettle外掛開發樣例,這個樣例很重要,可以大大簡化開發難度: 
https://jaist.dl.sourceforge.net/project/pentaho/Pentaho%208.1/plugins/kettle-sdk-plugin-assembly-8.1.0.0-365.zip 


注意選擇版本,其它版本可以在這裡下載: 
https://sourceforge.net/projects/pentaho/files/

下載好之後,在eclipse中匯入maven專案,將\kettle-sdk-step-plugin目錄下的專案匯入eclipse 
後續的外掛開發可以直接在這個專案的基礎上修改。 
相關文件在這裡: 
https://help.pentaho.com/Documentation/8.1/Developer_Center/PDI/Extend/000

SVG圖示編輯
https://c.runoob.com/more/svgeditor/