【问题标题】:Tycho build with optional dependencies to SWT and RAPTycho 构建与 SWT 和 RAP 的可选依赖项
【发布时间】:2015-11-02 08:36:24
【问题描述】:

我有一个有两个版本的应用程序:swt 和 rap。因此,在我的插件中,我对它们都有可选的依赖关系,当缺少一个时,另一个存在,反之亦然。问题是,在第谷中我只能要求或忽略可选的依赖项。有什么办法可以解决这个问题吗?

【问题讨论】:

    标签: eclipse maven swt tycho eclipse-rap


    【解决方案1】:

    我的建议:不要使用可选依赖项。在我的单一来源的 RCP/RAP 项目中,我创建了几个空/“假”插件,只有 id 很重要,没有来源。

    RAP 构建

    • org.eclipse.jface.databinding
    • org.eclipse.ui
    • org.eclipse.ui.forms

    RCP 构建

    • org.eclipse.rap.jface.databinding
    • org.eclipse.rap.ui
    • org.eclipse.rap.ui.form

    【讨论】:

      【解决方案2】:

      我已经找到了解决方案。它有两个单独的 rcp 和 rap 配置文件,忽略可选依赖项并为我在该特定配置文件中需要的每个包定义额外要求,例如:

      <profiles>
        <profile>
          <id>rap</id>
          <activation>
            <activeByDefault>false</activeByDefault>
            <property>
              <name>maven.profile</name>
              <value>rap</value>
            </property>
          </activation>
          <repositories>
            ...
          </repositories>
          <modules>
            ...
          </modules>
          <build>
            <plugins>
              <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>target-platform-configuration</artifactId>
                <version>${tycho-version}</version>
                <configuration>
                  <dependency-resolution>
                    <optionalDependencies>ignore</optionalDependencies>
                    <extraRequirements>
                      <requirement>
                        <type>eclipse-plugin</type>
                        <id>org.eclipse.rap.ui</id>
                        <versionRange>0.0.0</versionRange>
                      </requirement>
                      <requirement>
                        <type>eclipse-plugin</type>
                        <id>org.eclipse.rap.ui.views</id>
                        <versionRange>0.0.0</versionRange>
                      </requirement>
                    </extraRequirements>
                  </dependency-resolution>
                </configuration>
              </plugin>
            </plugins>
          </build>
        </profile>
      </profiles>
      

      这就是我在顶级 pom.xml 中的内容,如果您构建中的某个包对来自该构建的其他包具有可选的依赖关系,那么如果您在顶级 pom.xml 中添加额外的要求,则会出现循环依赖。解决方案只是将额外的要求添加到具有依赖关系的捆绑包的 pom 中 - 您只需将其放在它应该位于的配置文件中

      【讨论】:

        猜你喜欢
        • 2012-09-04
        • 1970-01-01
        • 2021-07-10
        • 1970-01-01
        • 1970-01-01
        • 2017-05-04
        • 1970-01-01
        • 2012-04-30
        • 1970-01-01
        相关资源
        最近更新 更多