Im my project i use the following dependencies to build a captcha in gradle module and deploy it to liferay 7
dependencies{
compile group: 'com.octo.captcha', name: 'jcaptcha', version: tcVersion('com.octo.captcha')
// compile group: 'com.octo.captcha', name: 'jcaptcha-api', version: '2.0-alpha-1'
compile group: 'com.jhlabs', name: 'filters', version: '2.0.235-1'
}
the problem is when i try to deploy my bundle i get the following error
org.osgi.framework.BundleException: Could not resolve module: com.myproject.vaadin.util [810]
Unresolved requirement: Import-Package: com.sun.image.codec.jpeg
apparently, com.sun.image.codec.jpeg
is being used. it is in rt.jar in the jdk so i dont need to extra include it, but it seems that i should include it. in gradle the project compiles successfuly and the bundle gets deployed in the gogo shell but when i try to start the bundle i get the descriped error
You dependency is not available in your runtime for your module. When building in Gradle it is available, as mentioned, because it is on your build classpath. In runtime however, you module declares that it needs to import this package from a OSGi bundle, which does not exist.
You have some options to explore here. You can use compileInclude to include the library in a fat Jar in Gradle (Liferay workspace); use the bnd file to include as a resource and set the bundle's classpath to include the jar; build a uber module that carries the package you need to the runtime in its on bundle; or find a bundle that exports it without you needing to build extra stuff.
Bottom line: you need to make the package available in runtime as an exported package.