【问题标题】:How to setup bundle development environment (Eclipse Equinox Maven)如何设置捆绑开发环境(Eclipse Equinox Maven)
【发布时间】:2010-11-27 18:17:52
【问题描述】:

我正在尝试设置 Eclipse 环境来开发捆绑包(使用 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 以将所有依赖的包复制到一个文件夹中(另一个问题是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 中运行和调试它们?

【问题讨论】:

    标签: eclipse maven-2 bundle equinox


    【解决方案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>
    

    【讨论】:

      【解决方案2】:

      我编写了一个名为 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 存储库,我有一些用于下载依赖项的代码。如果有人有兴趣,那么我可以将依赖项下载与自动生成器集成。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-08-31
        • 1970-01-01
        • 2017-05-24
        • 1970-01-01
        • 1970-01-01
        • 2018-06-19
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多