Hi, I’m new to Gradle. I’m trying to create a OSGI bundle with rest services in it. But, before my rest services work, I’m not able to run the bundle in Karaf container. At the same time the cxf example in apache servicemix package works fine. I keep getting the following error -
org.osgi.framework.BundleException: Unresolved constraint in bundle CACHE [44]: Unable to resolve 44.0: missing requirement [44.0] package; (&(package=javax.ws.rs)(version>=2.0.0)(!(version>=3.0.
When I copy the javax jar in the deploy folder this error is removed and another missing requirement error pops up. From what I can understand is that at runtime, it is not able to get the dependecies. Though, I have also copied my dependencies in a lib folder inside the packaged jar. I’m putting my build script here, I checked over the internet but could not find anything that could make it work. Please advice. I’m short of time and have to complete this for a demo.
build script ----
apply plugin: 'java'
apply plugin: 'osgi'
apply plugin: 'groovy'
apply plugin: 'application'
repositories {
mavenCentral()
}
configurations {
extraLibs
}
dependencies {
compile group: 'net.sf.ehcache', name: 'ehcache', version: '2.8.0'
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.5'
compile 'javax.ws.rs:javax.ws.rs-api:2.0'
compile group: 'org.osgi', name: 'osgi_R4_core', version: '1.0'
compile 'org.json:json:20131018'
testCompile 'junit:junit:4.8.2'
extraLibs 'net.sf.ehcache:ehcache:2.8.0'
extraLibs 'org.slf4j:slf4j-api:1.7.5'
extraLibs 'javax.ws.rs:javax.ws.rs-api:2.0'
extraLibs 'org.json:json:20131018'
}
// startScripts.classpath += files('$APP_HOME/lib/*')
version = '1.0'
jar {
into('') {
from configurations.extraLibs
}
manifest {
version = '1.0.0'
symbolicName = 'CACHE'
instruction 'Bundle-Activator', 'com.cache.activator.CacheActivator'
}
}
thank you!