Expand my Community achievements bar.

SOLVED

Bundle - Cannot be resolved dependecies

Avatar

Level 4

I'm dealing with these errors in my bundle.

I'm on aem 6.4

I've done the following:

  1. Checked the IDE for any errors before the deploy
  2. Changed the Core Bundle version
  3. Updated those dependencies with a newer version
  4. Right click on root POM -> Maven - > Generate Sources and Update Folders

1683757_pastedImage_0.png


What else can I do?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Your bundle requires "commons.net" version to be from 3.3-4 (exclusive) but AEM/Felix is unable to provide the same version. Hence, include "commons.net" bundle with either version from 3.3-4 and package it within your source code bundle. You may check if the same bundle is available in Felix with a different version or not?

Alternatively, if you don't need this bundle then add "!org.apache.commons.net.util" in the <Import-Package> of <maven-bundle-plugin>

Similar approach goes for "commons-validator". Provide either version from 1.6 to 2 or otherwise, block this dependency to be included in your import statements as applicable.

Maven Repository: commons-net » commons-net

Maven Repository: commons-validator » commons-validator

OR   // based on your use case

<groupId>org.apache.felix</groupId>

<artifactId>maven-bundle-plugin</artifactId>

<extensions>true</extensions>

<configuration>

<instructions>

<Import-Package>!org.apache.comons.net.util,!org.apache.commons.validator.routines,*</Import-Package>

</instructions>

</configuration>

View solution in original post

5 Replies

Avatar

Correct answer by
Level 10

Your bundle requires "commons.net" version to be from 3.3-4 (exclusive) but AEM/Felix is unable to provide the same version. Hence, include "commons.net" bundle with either version from 3.3-4 and package it within your source code bundle. You may check if the same bundle is available in Felix with a different version or not?

Alternatively, if you don't need this bundle then add "!org.apache.commons.net.util" in the <Import-Package> of <maven-bundle-plugin>

Similar approach goes for "commons-validator". Provide either version from 1.6 to 2 or otherwise, block this dependency to be included in your import statements as applicable.

Maven Repository: commons-net » commons-net

Maven Repository: commons-validator » commons-validator

OR   // based on your use case

<groupId>org.apache.felix</groupId>

<artifactId>maven-bundle-plugin</artifactId>

<extensions>true</extensions>

<configuration>

<instructions>

<Import-Package>!org.apache.comons.net.util,!org.apache.commons.validator.routines,*</Import-Package>

</instructions>

</configuration>

Avatar

Level 4

I'm using the following dependencies: a~

<dependency>
  <groupId>commons-validator</groupId>
  <artifactId>commons-validator</artifactId>
  <version>1.6</version>
</dependency>
<dependency>
  <groupId>commons-net</groupId>
  <artifactId>commons-net</artifactId>
  <version>3.3</version>
</dependency>

And the following import statements:

import org.apache.commons.validator.routines.EmailValidator;

import org.apache.commons.net.util.SubnetUtils;

I don't see what is wrong with these.

Avatar

Level 10

That's for compile time dependencies

Are these jars being packaged inside your code bundle to be available in Felix when your bundle is activated? You may unzip your bundle and validate.