Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: [LF71GA2] Unresolved requirement: Import-Package: com.google.zxing
Hi, i'm having a hard time with gradle dependencies, here is the situation, in my build.gradle i have the following dependecies:
in my class i have the following imports without any errors:
in project and external dependencies i have the following jars:
so, all seems to be ok, but when i deploy the module on the server i get this error:
As you can see in the screens attached, i really don't understand what's going wrong, can someone help me?
Thanks
compile group: 'com.google.zxing', name: 'core', version: '3.3.0'
compile group: 'com.google.zxing', name: 'javase', version: '3.3.0'
in my class i have the following imports without any errors:
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
in project and external dependencies i have the following jars:
javase-3.3.0.jar
core-3.3.0.jar
so, all seems to be ok, but when i deploy the module on the server i get this error:
Unresolved requirement: Import-Package: com.google.zxing
As you can see in the screens attached, i really don't understand what's going wrong, can someone help me?
Thanks
Diego CantoneAt build-time, all requirements are met. The compiler knows the code that you're referring to.
so, all seems to be ok, but when i deploy the module on the server i get this error:Unresolved requirement: Import-Package: com.google.zxing
At run-time, Liferay does not have access to all the code that was around at build time. Ideally the zxing jars would be OSGi bundles (please check), then you can just deploy them to Liferay. Otherwise you'll have to embed the code in your own modules.
Note that you might need some transitive dependencies as well. I don't have experience with the use of the zxing libraries.
Olaf KockDiego CantoneAt build-time, all requirements are met. The compiler knows the code that you're referring to.
so, all seems to be ok, but when i deploy the module on the server i get this error:Unresolved requirement: Import-Package: com.google.zxing
At run-time, Liferay does not have access to all the code that was around at build time. Ideally the zxing jars would be OSGi bundles (please check), then you can just deploy them to Liferay. Otherwise you'll have to embed the code in your own modules.
Note that you might need some transitive dependencies as well. I don't have experience with the use of the zxing libraries.
Hi Olaf, thank for the answer, i've found the same library as an OSGI bundle, or i think so, correct me if i'm wrong, it should be this
compile group: 'org.apache.servicemix.bundles', name: 'org.apache.servicemix.bundles.zxing', version: '3.3.0_1'
so as you said, and as is written in this tutorial , now it should work without problem..But sadly i continue to get the same error.
Diego CantoneHi Diego,
But sadly i continue to get the same error.
it's not enough to change the compiler dependencies: That will only help you during build-time. At runtime, Liferay needs to have access to the libraries as well. Take the OSGi bundle(s) for this library and deploy it/them to Liferay, e.g. by dropping them into the deploy folder. Then you'll have them available at runtime as well, and the dependency issue should be resolved. (unless you're missing transitive dependencies)
Hi Diego,
try using:
The 'compileInclude' configuration allows you to include the dependency in the compile classpath.
Open your jar after the build: you will be able to find all the classes you need to run your code.
try using:
compileInclude group: 'com.google.zxing', name: 'core', version: '3.3.0'
compileInclude group: 'com.google.zxing', name: 'javase', version: '3.3.0'
The 'compileInclude' configuration allows you to include the dependency in the compile classpath.
Open your jar after the build: you will be able to find all the classes you need to run your code.
Thanks for the answers, i solved by editing the .bnd file with the include-resource tag and by including every jar needed with @core-3.3.0.jar,@javase-3.3.0.jar and so on.
Hi Diego Cantone,
I am facing same problem. How you resolved?
Could please share me your gradle and bnd file for reference.
Thanks you
I am facing same problem. How you resolved?
Could please share me your gradle and bnd file for reference.
Thanks you
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™