Tycho是一个Maven插件,旨在简化使用Maven构建Eclipse插件,OSGI Bundle等项目。
一、插件项目的构建
有了Tycho,构建一个Eclipse插件工程变的非常简单:
新建一个Eclipse插件项目me.dollyn.tycho.example.plugin,这里利用了Eclipse New Plugin Project Wizard中的Hello, World Command模板 新建一个pom.xml文件,Tycho提供了一个命令,可以方便地为一个插件项目生成pom文件: mvn org.eclipse.tycho:tycho-pomgenerator-plugin:generate-poms -DgroupId=me.dollyn.tycho.example 生成的文件内容:
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>me.dollyn.tycho.example</groupId>
<artifactId>me.dollyn.tycho.example.plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
这只是基本信息,还需要配置tycho插件:
<properties>
<tycho-version>0.16.0</tycho-version>
</properties>
<repositories>
<repository>
<id>indigo</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/indigo</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
是的,就是这么简单的一个pom,就可以构建一个插件项目了! 运行下面的命令:
mvn clean install 第一次运行,可能需要下载的东西比较多,以后