简体   繁体   English

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

[英]How to setup bundle development environment (Eclipse Equinox Maven)

I'am trying to setup eclipse environment to develop bundles (With maven-bundle-plugin-bnd) and run & debug that bundles equinox from eclipse 我正在尝试设置eclipse环境以开发捆绑包(使用maven-bundle-plugin-bnd)并运行和调试从Eclipse捆绑春分点

I created sample bundles with org.apache.felix maven-bundle-plugin and can install and start that bundles from eclipse equinox, 我使用org.apache.felix maven-bundle-plugin创建了示例捆绑包,可以从Eclipse春分点安装和启动该捆绑包,
but every time i need to run "install file:C:\\path\\bundle1.jar","install file:C:\\path\\bundle2.jar" which causes pain. 但是每次我需要运行“安装文件:C:\\ path \\ bundle1.jar”,“安装文件:C:\\ path \\ bundle2.jar”时,都会引起痛苦。 i searched for run configuration but it only intalls and starts (plugin) projects in workspace not maven projects. 我搜索了运行配置,但它仅安装并启动(插入)项目,而不是Maven项目。

What i have done is create maven project and add dependencies(bundle1,bundle2 etc..) and added maven-dependency-plugin to copy all depended bundles in one folder (another problem is equinox use "_" delimeter to determine version of bundles but maven uses "-" as delimeter) if i do not strip version in standalone equinox application i need to give version of bundle in config.ini file but i dont want that, is this proper way to solve this problem? 我所做的是创建maven项目并添加依赖项(bundle1,bundle2等。)并添加了maven-dependency-plugin以将所有依赖的包复制到一个文件夹中(另一个问题是春分使用“ _”定界符确定包的版本,但是maven使用“-”作为分隔符)如果我不剥离独立的春分应用程序中的版本,我需要在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>  

To sum up , i have bundles in folder, which is created with org.apache.felix maven-bundle-plugin , how can i run and debug them from eclipse? 总结一下,我在org.apache.felix maven-bundle-plugin创建的文件夹中有捆绑包,如何从Eclipse中运行和调试它们?

I wouldn't say this is a "proper" solution, but it may work for you. 我不会说这是一个“适当的”解决方案,但它可能对您有用。

The antrun plugin can be used to modify the dependencies to replace the final hyphen with an underscore, so the dependency plugin doesn't need to strip the version. antrun插件可用于修改依赖项,以用下划线替换最终的连字符,因此,依赖项插件无需剥离版本。

My regex is rusty, but from a little testing the following configuration appears to apply the required name change to the files in the bundleDependency directory. 我的正则表达式很生锈,但是经过一点测试,下面的配置似乎将所需的名称更改应用于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>

I wrote a tool called auto-builder ( http://code.google.com/p/auto-builder ). 我编写了一个名为auto-builder的工具( http://code.google.com/p/auto-builder )。 It introspects PDE-based projects and generates Ant build files; 它会检查基于PDE的项目并生成Ant构建文件。 it supports transitive closure over dependencies and all that jazz. 它支持对依赖项和所有爵士乐的传递闭包。

I posted a write-up: http://empty-set.net/?p=9 . 我张贴了一篇文章: http : //empty-set.net/?p=9 I wrote it because the Maven tools I played with, when integrated with PDE, didn't “just work.” Basically, I wanted to do coding in PDE and have a Hudson-based CI without any fuss in between. 我之所以写它是因为与PDE集成时,我玩过的Maven工具不能“正常工作”。基本上,我想在PDE中进行编码,并且希望拥有一个基于Hudson的CI,而不会在此之间大惊小怪。

Generating Ant files is nice because it gives you all the benefits of a declarative build tool, but it leaves you with a procedural description of what it is doing. 生成Ant文件很不错,因为它为您提供了声明式构建工具的所有优点,但它为您提供了有关其工作的过程说明。

I am looking for more PDE-based projects to test it on. 我正在寻找更多基于PDE的项目对其进行测试。 There are a couple RFC-0112 Bundle repositories around, and I have some code for downloading dependencies. 周围有几个RFC-0112捆绑存储库,我有一些用于下载依赖项的代码。 If anyone is interested, then I could integrate dependencies download with auto-builder. 如果有人感兴趣,那么我可以将依赖项下载与自动构建器集成在一起。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM