使用Eclipse Tycho构建Eclipse Plugin项目

Eclipse Tycho简介#

Tycho is an project which provides a set of Maven plug-ins for building Eclipse components via the command line. Tycho supports the build process of Eclipse plug-ins, features, update sites (based on p2) and products. Combined with a continuous integration server, for example a Hudson or Jenkins instance, Tycho allows configuring an integration build for Eclipse components. Tycho uses the metadata of the Eclipse components files as much as possible, e.g., for plug-ins it determines the dependencies via theMANIFEST.MF
file.

The main Tycho Maven plug-in for is the tycho-maven-plugin
plug-in. This plug-ins supports building Eclipse projects, it enables Maven to understand package types such as eclipse-plugin, eclipse-feature and eclipse-repository.

To use Tycho you only have to install the Maven build tool. The Tycho plug-ins for Maven are automatically downloaded and installed by Maven based on your Maven configuration file.

安装Maven#

Vogel: [Apache Maven tutorial]

Tycho 配置#

启用Tycho-maven 插件##

启用Tycho很简单,把下面的properties和build标签加入到parent pom文件即可

   <properties>
      <tycho-version>0.24.0</tycho-version>
   </properties>

   <build>
      <plugins>
         <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-maven-plugin</artifactId>
            <version>${tycho-version}</version>
            <extensions>true</extensions>
         </plugin>
      </plugins>
   </build>

设置repository##

repository标签用来设定一个Eclipse 官方p2仓库,从这个仓库可以获取Tycho以及Eclipse插件或者OSGi模块化开发所需的大量编译好的模块

<properties> 
    <repo.url.mars>http://download.eclipse.org/releases/mars</mars-repo.url>
  </properties>

<repository>
    <id>eclipse-mars</id>
    <url>${repo.url.mars}</url>
    <layout>p2</layout>
</repository>

Tycho构建

# switch to the directory of you plug-in
cd com.vogella.tycho.plugin1
# run build
mvn clean verify

参考&资源#

wiki:Tycho/Reference Card
Vogel:Eclipse Tycho for building Eclipse Plug-ins and RCP applications
maven&tycho
DEMO:Building Eclipse Plug-ins and RCP Applications with Tycho

    原文作者:murphy1314
    原文地址: https://www.jianshu.com/p/0103fa3f045c
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞