1. 程式人生 > 實用技巧 >Eclipse RCP:多平臺部署

Eclipse RCP:多平臺部署

1 問題

  在使用Eclipse RCP IDE進行開發時,它自帶的PDE(外掛開發環境)工具僅能夠匯出相同平臺的部署包,比如win32的僅能匯出win32的,linux64僅能夠匯出linux64的。

  如果我在win64上進行開發,但是我想匯出win32、linux64、linux32、mac64下能夠執行的部署包呢?最笨的辦法是分別下載這幾個平臺的Eclipse RCP IDE,然後再進行匯出,這種方法操作起來非常繁瑣。更好的辦法是使用tycho。

2 測試環境

win8 x64

ubuntu 18 x64

tycho 1.4

3 tycho簡介

  Tycho is focused on a Maven-centric, manifest-first approach to building Eclipse plug-ins, features, update sites, RCP applications and OSGi bundles. Tycho is a set of Maven plugins and extensions for building Eclipse plugins and OSGi bundles with Maven. Eclipse plugins and OSGi bundles have their own metadata for expressing dependencies, source folder locations, etc. that are normally found in a Maven POM. Tycho uses native metadata for Eclipse plugins and OSGi bundles and uses the POM to configure and drive the build. Tycho supports bundles, fragments, features, update site projects and RCP applications.

  簡單地說,tycho是一個maven外掛,可以用它來進行eclipse打包,可用於匯出plugin,feature, product,update site等。

4 maven核心配置

  1 <properties>
  2     <tycho-version>1.4.0</tycho-version>
  3 </properties>
  4 
  5 <build>
  6 <plugins>
  7     <plugin>
  8         <groupId>org.eclipse.tycho</
groupId> 9 <artifactId>tycho-maven-plugin</artifactId> 10 <version>${tycho-version}</version> 11 <extensions>true</extensions> 12 </plugin> 13 14 <plugin> 15 <groupId>org.eclipse.tycho</groupId>
16 <artifactId>target-platform-configuration</artifactId> 17 <version>${tycho-version}</version> 18 <configuration> 19 <environments> 20 <environment> 21 <os>win32</os> 22 <ws>win32</ws> 23 <arch>x86</arch> 24 </environment> 25 <environment> 26 <os>win32</os> 27 <ws>win32</ws> 28 <arch>x86_64</arch> 29 </environment> 30 <environment> 31 <os>linux</os> 32 <ws>gtk</ws> 33 <arch>x86_64</arch> 34 </environment> 35 <environment> 36 <os>linux</os> 37 <ws>gtk</ws> 38 <arch>x86_64</arch> 39 </environment> 40 <environment> 41 <os>macosx</os> 42 <ws>cocoa</ws> 43 <arch>x86_64</arch> 44 </environment> 45 </environments> 46 </configuration> 47 </plugin> 48 </plugins> 49 </build> 50

5 參考

http://www.eclipse.org/tycho/

你的點贊與分享是對我最大的支援