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

时间:2009-09-12 14:01:33

标签: eclipse maven-2 bundle equinox

我正在尝试设置eclipse环境来开发bundle(使用maven-bundle-plugin-bnd) 并运行&调试捆绑来自eclipse的equinox

我使用org.apache.felix maven-bundle-plugin创建了示例包,可以从eclipse equinox安装和启动这些包,
但每次我需要运行“安装文件:C:\ path \ bundle1.jar”,“安装文件:C:\ path \ bundle2.jar”会导致疼痛。我搜索了运行配置,但它只在工作空间中启动并启动(插件)项目而不是maven项目。

我所做的是创建maven项目并添加依赖项(bundle1,bundle2等......)并添加maven-dependency-plugin以将所有依赖的bundle复制到一个文件夹中(另一个问题是equinox使用“_”delimeter来确定版本捆绑但maven使用“ - ”作为分隔符)如果我不在独立的equinox应用程序中剥离版本我需要在config.ini文件中给出bundle的版本但我不想要那个,这是解决这个问题的正确方法吗?

<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 个答案:

答案 0 :(得分:1)

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

antrun plugin可用于修改依赖关系以用下划线替换最后的连字符,因此依赖插件不需要剥离版本。

我的正则表达式是生锈的,但是通过一些测试,以下配置似乎将所需的名称更改应用于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>

答案 1 :(得分:0)

我写了一个名为auto-builder(http://code.google.com/p/auto-builder)的工具。它内省了基于PDE的项目并生成了Ant构建文件;它支持依赖关系和所有爵士乐的传递闭包。

我发了一篇文章:http://empty-set.net/?p=9。我写这篇文章是因为我使用的Maven工具,当与PDE集成时,并不“只是工作。”基本上,我想在PDE中进行编码并且在基于Hudson的CI之间没有任何大惊小怪。

生成Ant文件很不错,因为它为您提供了声明性构建工具的所有好处,但它为您提供了对它正在做什么的程序描述。

我正在寻找更多基于PDE的项目来测试它。有几个RFC-0112 Bundle存储库,我有一些代码用于下载依赖项。如果有人感兴趣,那么我可以将依赖项下载与自动构建器集成。