I'm trying to build an eclipse plugin but it fails because it requires org.junit osgi bundle.
How can I provide this bundle to the build ?
[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] ------------------------------------------------------------------------
I tried adding junit in the dependency section :
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
After that I had a new warning :
[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"/>
I followed the hint given in the message and added this line to the feature.xml :
<plugin id="org.scala-ide.junit.junit" version="4.11" download-size="0" install-size="0" unpack="false"/>
below the 2 other plugin entries:
<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"/>
The pom is :
<?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>
I don't have a target platform artifact where I would do something like:
<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>
Can I still add org.junit to the target platform in my maven pom.xml ?
I added this to the pom and that solved at least the part of the build requiring 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>