Importing 3rd Party Java Maven Dependency, com.google.cloud, Google ReCaptcha Enterprise, google-cloud-recaptchaenterprise Errors in Bundle in 2023 | Community
Skip to main content
Level 2
July 19, 2023
Solved

Importing 3rd Party Java Maven Dependency, com.google.cloud, Google ReCaptcha Enterprise, google-cloud-recaptchaenterprise Errors in Bundle in 2023

  • July 19, 2023
  • 4 replies
  • 4098 views

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

and https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/archetype/build-analyzer-maven-plugin.html?lang=en

 

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by ayushmishra07

Hi @brianli1 ,

 

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

4 replies

Rohan_Garg
Community Advisor
Community Advisor
July 20, 2023

Could you check out the below URL for your query?

Google Enterprise Captcha Integration

BrianLi1Author
Level 2
July 20, 2023

I tried it, does not work.

Sady_Rifat
Community Advisor
Community Advisor
July 20, 2023

Hello @brianli1 ,

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 

BrianLi1Author
Level 2
July 20, 2023

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.

ayushmishra07
Adobe Employee
Adobe Employee
July 20, 2023

Hi @brianli1 ,


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 : 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/convert-html-to-markdown/m-p/604676#M151605 

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

BrianLi1Author
Level 2
July 20, 2023

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.

ayushmishra07
Adobe Employee
ayushmishra07Adobe EmployeeAccepted solution
Adobe Employee
July 20, 2023

Hi @brianli1 ,

 

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

Sudheer_Sundalam
Community Advisor
Community Advisor
July 20, 2023

@brianli1 ,

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>

 

 

BrianLi1Author
Level 2
July 20, 2023

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

October 25, 2023

Hi @brianli1 

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