如何设置捆绑开发环境(Eclipse Equinox Maven)

3

我正在尝试设置Eclipse环境来开发插件(使用Maven-bundle-plugin-bnd),并从Eclipse中运行和调试Equinox插件。

我使用org.apache.felix Maven-bundle-plugin创建了示例插件,并可以从Eclipse Equinox安装和启动这些插件,但每次都需要运行“install file:C:\path\bundle1.jar”,“install file:C:\path\bundle2.jar”等命令,这很麻烦。我搜索过运行配置,但它只能安装和启动工作区中的插件项目,而不能处理Maven项目。

我创建了Maven项目,并添加了依赖关系(bundle1、bundle2等),并添加了Maven-dependency-plugin,将所有依赖的插件复制到一个文件夹中。另一个问题是,Equinox使用“_”作为分隔符来确定插件版本,但Maven使用“-”。如果我不在独立的Equinox应用程序中剥离版本,我需要在config.ini文件中给出插件的版本,但我不想这样做。这是解决这个问题的适当方法吗?

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-dependencies</id>
            <phase>package</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <outputDirectory>${bundleDirectory}</outputDirectory>
              <overWriteReleases>false</overWriteReleases>
              <overWriteSnapshots>true</overWriteSnapshots>
              <stripVersion>true</stripVersion>
            </configuration>
          </execution>
        </executions>
      </plugin>  

总之,我有一个文件夹里面有一些捆绑包,这些捆绑包是使用org.apache.felix maven-bundle-plugin创建的,我该如何从eclipse中运行和调试它们?
2个回答

1

我不会说这是一个“正式”的解决方案,但它可能适合你。

antrun插件可以用来修改依赖项,将最后的连字符替换为下划线,这样依赖项插件就不需要剥离版本了。

我的正则表达式有点生疏,但经过一些测试,以下配置似乎适用于在bundleDependency目录中更改所需名称的文件。

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-dependency-plugin</artifactId>
  <executions>
    <execution>
      <id>copy-dependencies</id>
      <phase>package</phase>
      <goals>
        <goal>copy-dependencies</goal>
      </goals>
      <configuration>
        <outputDirectory>${bundleDirectory}</outputDirectory>
        <overWriteReleases>false</overWriteReleases>
        <overWriteSnapshots>true</overWriteSnapshots>
      </configuration>
    </execution>
  </executions>
</plugin>
<plugin>
  <artifactId>maven-antrun-plugin</artifactId>
  <version>1.3</version>
  <executions>
    <execution>
      <phase>package</phase>
      <configuration>
        <tasks>
          <!-- move within same directory is preferred method for a rename-->
          <move todir="${bundleDirectory}">
            <fileset dir="${bundleDirectory}"/>
            <mapper type="regexp" from="([a-zA-Z0-9\.-]+)(-)([0-9\.]+.jar)" 
              to="\1_\3"/>
          </move>
        </tasks>
      </configuration>
      <goals>
        <goal>run</goal>
      </goals>
    </execution>
  </executions>
  <dependencies>
   <dependency>
     <groupId>ant</groupId>
     <artifactId>ant-nodeps</artifactId>
     <version>1.6.5</version>
   </dependency>
  </dependencies>
</plugin>

0

我写了一个叫做auto-builder的工具(http://code.google.com/p/auto-builder)。它可以自动分析基于PDE的项目并生成Ant构建文件;它支持依赖的传递闭包等各种功能。

我发布了一篇介绍文章:http://empty-set.net/?p=9。我写这篇文章是因为我在与PDE集成时使用的Maven工具并不完美地运行。基本上,我想在PDE中进行编码,并且在其中没有任何麻烦的情况下使用基于Hudson的CI。

生成Ant文件很好,因为它给你带来了声明式构建工具的所有优势,但它留给你的是过程化描述。

我正在寻找更多基于PDE的项目来测试它。周围有几个RFC-0112 Bundle仓库,并且我有一些用于下载依赖项的代码。如果有人感兴趣,我可以将依赖项下载整合到auto-builder中。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接