We are trying to utilize the JAVA libraries presented by Google's Enterprise reCAPTCHA library, but we keep getting errors while trying to use a 3rd party library...
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-recaptchaenterprise</artifactId>
<version>3.18.0</version>
</dependency>
We've added this dependency to:
/core/pom.xml
/pom.xml
and after maven build, I am getting this error.
We also taken an extra step to trying to embed the groupID and artifactID into the all package, which will <embed> the jar into /apps/my-site/my-site-packages/install, but still getting these red errors.
We went through several blogs like:
https://www.linkedin.com/pulse/how-add-third-party-bundle-you-aem-package-veena-vikraman/
https://myaemlearnings.blogspot.com/2021/08/embedding-third-party-dependencyosgi.html
Not able to find a solution for this. Does anyone know how to properly import a non-osgi library into an AEM project (core), in 2023?
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @2490242973 ,
The dependencies that are coming as red now would be the transitive dependencies based on the the main dependency that you have. when using -conditionalpackage you need to add the transitive dependencies as well.
Please add all the dependencies in the -conditionalpackage which are showing as red, in case new dependencies are shown in red after building please add those as well.
Explanation around why you are seeing more red errors and how will it resolve the issue :
Also, as the dependency which was originally showing as error is not showing the error anymore what it signifies is that those particular dependencies got resolved but then when it tried to build those individual classes it found these other dependencies and now is trying to resolve it but is unable to find. Thus, you need to provide all the required dependencies in the -conditionalpackage statement.
Thanks,
Ayush
I tried it, does not work.
Hello @2490242973 ,
The article you shared should be working. https://myaemlearnings.blogspot.com/2021/08/embedding-third-party-dependencyosgi.html
However, you might be doing a mistake that's why it's not working for you. So I pushed a commit for a new project. Just have a look the changes and I tested in my local environment also.
https://github.com/Sady-Rifat/aem-demo/commit/65f8ce112744134728bf2f85d7bc5f131a2ef290
I appreciate you putting in the time to install this, but yet I am still getting red in the system console, and so my bundle is not starting.
When Building, I get importing package(s) [com.google.cloud.recaptchaenterprise.v1, com.google.recaptchaenterprise.v1] in start level 20 but no bundle is exporting these for that start level.
is importing package(s) [Package com.google.common.base;version=[14.0,15), Package com.google.common.collect;version=[14.0,15)] in start level 20 but no visible bundle is exporting these for that start level in the required version range.
Hi @2490242973 ,
In case it is still not working you can try using the bnd-maven-plugin. I personally feel that is more easier and straight-forward to use with minimum changes.
To get more details please refer to this link :
https://myaemlearnings.blogspot.com/2021/12/embed-third-party-dependency-using-bnd.html
You can also refer to the following example for your implementation :
Basically you just need to provide the list of all the Java package names of desired dependency as part of -conditionalpackage instruction(including its transitive dependencies).
Hope it helps.
Thanks,
Ayush
thanks, but its not working... still getting red. The conditional package is actually making it worst.
com.google.api.core -- Cannot be resolved
com.google.api.gax.core -- Cannot be resolved
com.google.api.gax.grpc -- Cannot be resolved
com.google.api.gax.paging -- Cannot be resolved
com.google.api.gax.retrying -- Cannot be resolved
com.google.api.gax.rpc -- Cannot be resolved
com.google.common.base,version=[14.0,15) -- Cannot be resolved
com.google.common.collect,version=[14.0,15) -- Cannot be resolved
com.google.common.util.concurrent,version=[14.0,15) -- Cannot be resolved
com.google.gson,version=[2.8,3) from com.google.gson (501)
com.google.gson.annotations,version=[2.8,3) from com.google.gson (501)
com.google.longrunning -- Cannot be resolved
com.google.longrunning.stub -- Cannot be resolved
com.google.protobuf,version=[3.23,4) -- Cannot be resolved
com.google.recaptchaenterprise.v1 -- Cannot be resolved
io.grpc -- Cannot be resolved
io.grpc.protobuf -- Cannot be resolved
All red now.
Hi @2490242973 ,
The dependencies that are coming as red now would be the transitive dependencies based on the the main dependency that you have. when using -conditionalpackage you need to add the transitive dependencies as well.
Please add all the dependencies in the -conditionalpackage which are showing as red, in case new dependencies are shown in red after building please add those as well.
Explanation around why you are seeing more red errors and how will it resolve the issue :
Also, as the dependency which was originally showing as error is not showing the error anymore what it signifies is that those particular dependencies got resolved but then when it tried to build those individual classes it found these other dependencies and now is trying to resolve it but is unable to find. Thus, you need to provide all the required dependencies in the -conditionalpackage statement.
Thanks,
Ayush
Can you give this a try in your core pom.xml and see if it works?
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Embed-Dependency>google-cloud-recaptchaenterprise</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<Export-Package>
com.yourproject.core.*;version=yourversion
</Export-Package>
</instructions>
</configuration>
</plugin>
Thanks, I tried this as well, it is not working.
Unable to get bundle symbolic name from artifact com.google.cloud:google-cloud-recaptchaenterprise:3.18.0
Hi @2490242973
I got the same error
Unable to get bundle symbolic name from artifact com.google.cloud:google-cloud-recaptchaenterprise:3.25.0
I see this is marked as resolved, could you share the detailed solution?
Thanks
Views
Replies
Total Likes
Views
Likes
Replies