0

I want to add the following dependency to org.eclipse.persistence.core:

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.21</version>
    <scope>provided</scope>
</dependency>

The first my naive attempt was to add it to org.eclipse.persistence.core/pom.xml. As expected it didn't work. After that following this https://stackoverflow.com/a/12410482/5057736 I added to org.eclipse.persistence.core/META-INF/MANIFEST.MF to Require-Bundle setting:

Require-Bundle: (original), org.slf4j;bundle-version="1.7.21"

However, I get

Caused by: java.lang.RuntimeException: No solution found because the problem is unsatisfiable.: [Unable to satisfy dependency from org.eclipse.persistence.core 2.6.3.qualifier to bundle org.slf4j 1.7.21.; No solution found because the problem is unsatisfiable.]

Could anyone give exact answer how to add this dependency to this org.eclipse.persistence.core project because after two hours, reading a lot of posts I have no solution.

Community
  • 1
  • 1
Pavel_K
  • 10,748
  • 13
  • 73
  • 186
  • First is org.slf4j providing OSGi bundles? I'm not sure...I would check the MANIFEST.MF of the packages...furthermore you are requiring a build `org.slf4j` but who offers this bundle ? – khmarbaise Jan 22 '17 at 18:27
  • @khmarbaise Thank you for your answer. I've checked - this jar is OSGI bundle. This is the link in maven https://mvnrepository.com/artifact/org.slf4j/slf4j-api/1.7.21 . I can't say more, because I don't know. – Pavel_K Jan 22 '17 at 18:43
  • mvnrepository.com is **NOT** Maven Central. Maven Central is here: https://repo1.maven.org/maven2/ The search engine is here: https://search.maven.org/ – khmarbaise Jan 23 '17 at 11:42
  • @khmarbaise Ok. This is the url https://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.21/ The jar file (https://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21.jar ) is also OSGi bundle. – Pavel_K Jan 23 '17 at 11:51
  • So this means first that your bundle name is wrong, cause the bundle name in slf4j is named: `sl4fj.api` – khmarbaise Jan 23 '17 at 13:03
  • @khmarbaise Sorry, I don't understand you. If you know solution, please give and answer and I will accept it if it works. – Pavel_K Jan 23 '17 at 13:55

1 Answers1

0

Use the Bundle-SymbolicName of the dependency in the Require-Bundle: header

In your case it should be:

Require-Bundle: (original), slf4j.api;bundle-version="1.7.21"
halfer
  • 19,824
  • 17
  • 99
  • 186
Hisham Khalil
  • 1,054
  • 8
  • 9
  • Thank you for your answer. I didn't answer because I didn't work with that problem. But now I am back. Your solution also gives the exception: `[java] Caused by: java.lang.RuntimeException: No solution found because the problem is unsatisfiable.: [Unable to satisfy dependency from org.eclipse.persistence.core 2.6.3.qualifier to bundle slf4j.api 1.7.21.; No solution found because the problem is unsatisfiable.] [java] at org.eclipse.tycho.p2.util.resolution.AbstractResolutionStrategy.newResolutionException(AbstractResolutionStrategy.java:98)` – Pavel_K Mar 21 '17 at 14:53