我如何满足这个依赖osgi包?

问题描述 投票:0回答:1

我正在尝试构建一个 Eclipse 插件,但它失败了,因为它需要 org.junit osgi 包。

如何将此捆绑包提供给构建?

[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: org.scala-ide.p2-update-site.feature.feature.group 4.7.1.qualifier
[ERROR]   Missing requirement: org.scala-refactoring.library 0.14.0.2_12-201709132327-af879be requires 'osgi.bundle; org.junit 4.11.0' but it could not be found
[ERROR]   Cannot satisfy dependency: org.scala-ide.p2-update-site.feature.feature.group 4.7.1.qualifier depends on: org.eclipse.equinox.p2.iu; org.scala-refactoring.library 0.0.0
[ERROR]
[ERROR] See https://wiki.eclipse.org/Tycho/Dependency_Resolution_Troubleshooting for help.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for org.scala-ide.p2-toolchain 4.7.1-SNAPSHOT:
[INFO]
[INFO] org.scala-ide.p2-toolchain ......................... SUCCESS [  0.104 s]
[INFO] org.scala-ide.zinc ................................. SUCCESS [  0.003 s]
[INFO] org.scala-ide.zinc.feature ......................... SUCCESS [  3.539 s]
[INFO] org.scala-ide.zinc.source.feature .................. SUCCESS [  1.528 s]
[INFO] org.scala-ide.zinc.update-site ..................... SUCCESS [  0.827 s]
[INFO] org.scala-ide.scala212.build ....................... SUCCESS [  0.003 s]
[INFO] org.scala-ide.scala212.feature ..................... SUCCESS [  0.521 s]
[INFO] org.scala-ide.scala212.source.feature .............. SUCCESS [  0.123 s]
[INFO] org.scala-ide.scala212.update-site ................. SUCCESS [  0.207 s]
[INFO] org.scala-ide.p2-update-site ....................... SUCCESS [  0.003 s]
[INFO] org.scala-ide.p2-update-site.feature ............... FAILURE [  0.247 s]
[INFO] org.scala-ide.p2-update-site.update-site ........... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  13.893 s
[INFO] Finished at: 2024-04-13T22:19:56+02:00
[INFO] ------------------------------------------------------------------------

我尝试在依赖项部分添加 junit :

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
    </dependency>

之后我收到了新的警告:

[WARNING] Maven Artifact junit:junit:4.11 is not a bundle and was automatically wrapped with bundle-symbolic name org.scala-ide.junit.junit, ignoring such artifacts can be enabled with <pomDependencies>consider</pomDependencies> in target platform configuration.
[INFO] The artifact can be referenced in feature files with the following data: <plugin id="org.scala-ide.junit.junit" version="4.11" download-size="0" install-size="0" unpack="false"/>

我按照消息中给出的提示,将此行添加到 feature.xml 中:

    <plugin id="org.scala-ide.junit.junit" version="4.11" download-size="0" install-size="0" unpack="false"/>

在其他 2 个插件条目下方:

   <plugin
         id="org.scala-refactoring.library"
         download-size="0"
         install-size="0"
         version="0.0.0"
         unpack="false"/>

   <plugin
         id="scalariform"
         download-size="0"
         install-size="0"
         version="0.0.0"
         unpack="false"/>

pom 是:

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.scala-ide</groupId>
    <artifactId>org.scala-ide.p2-toolchain</artifactId>
    <version>4.7.1-SNAPSHOT</version>
    <relativePath>../org.scala-ide.p2-toolchain/pom.xml</relativePath>
  </parent>

  <artifactId>org.scala-ide.p2-update-site</artifactId>
  <description>The local p2 repo for scala-refactoring</description>
  <packaging>pom</packaging>
  <version>4.7.1-SNAPSHOT</version>

  <dependencies>
    <dependency>
      <groupId>org.scala-refactoring</groupId>
      <artifactId>org.scala-refactoring.library_2.12.2</artifactId>
      <version>${scala-refactoring.version}</version>
    </dependency>
    <dependency>
      <groupId>org.scalariform</groupId>
      <artifactId>scalariform_${scala.minor.version}</artifactId>
      <version>${scalariform.version}</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
    </dependency>
  </dependencies>

  <repositories>
    <repository>
      <id>scala-ide.refactoring.repo</id>
      <name>Scala IDE refactoring repository</name>
      <url>${repo.scala-refactoring}</url>
      <snapshots>
        <updatePolicy>daily</updatePolicy>
      </snapshots>
    </repository>
  </repositories>

  <modules>
    <module>org.scala-ide.p2-update-site.feature</module>
    <module>org.scala-ide.p2-update-site.update-site</module>
  </modules>

</project>

我没有目标平台工件,我可以做类似的事情:

<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
  <repository location="http://download.eclipse.org/releases/2024-03/"/>
  <unit id="org.junit" version="0.0.0"/>
</location>

我仍然可以在我的 maven pom.xml 中将 org.junit 添加到目标平台吗?

eclipse-plugin osgi eclipse-rcp osgi-bundle scala-ide
1个回答
0
投票

我将其添加到 pom 中,这至少解决了构建中需要 osgi bundle junit 的部分:

  <build>
    <plugins>
      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>target-platform-configuration</artifactId>
        <configuration>
          <dependency-resolution>
            <extraRequirements>
              <requirement>
                <type>eclipse-plugin</type>
                <id>org.junit</id>
                <versionRange>4.11.0</versionRange>
              </requirement>
            </extraRequirements>
          </dependency-resolution>
        </configuration>
      </plugin>
    </plugins>
  </build>
© www.soinside.com 2019 - 2024. All rights reserved.