com.microsoft.sqlserver -- Maven build cannot resolve dependencies when imported | Community
Skip to main content
durga_kavali
July 17, 2023

com.microsoft.sqlserver -- Maven build cannot resolve dependencies when imported

  • July 17, 2023
  • 2 replies
  • 3678 views

Hi Team,

we are using AEM as cloud service and MS SQL Database to establish db connection ,I have added dependency to work on MS SQL db .

i have included the dependency in parent pom.xml with version:

<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.2.0.jre11</version>
</dependency>

 

dependency in core pom.xml with out version;

<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
</dependency

have added -includeresource in core pom.xml for the above jar in bnd-maven-plugin as below:

-includeresource: mssql-jdbc-12.2.0.jre11.jar;lib:=true

 

also tried including : export package;

com.microsoft.sqlserver.jdbc.*;version="11.2.0.jre11",\

 

getting below error:

 

 referred from below urls:

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-maven-build-cannot-resolve-dependencies-when-imported/td-p/275711

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/com-jcraft-jsch-cannot-be-resolved-aem-as-a-cloud/td-p/404197

 

still issue not resolved:

 

can some one help me how to resolve this. does anyone has the working pom.xml please share.

 

Thanks,

Durga Kavali.

 

 

 

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

2 replies

rawvarun
Community Advisor
Community Advisor
July 17, 2023
Tanika02
July 18, 2023

Hello Durga - 

 

Have you checked these ? 

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager-forms/connect-aem-with-mysql-aem-6-4/m-p/321391 

https://www.albinsblog.com/2015/03/how-to-connect-to-oracle-database-using.html 

https://medium.com/@theopendle/aem-connect-aem-to-an-external-database-oracle-example-4d3b9d43708 

 

Another suggestion - 

  1. Open the core/pom.xml file and add the following dependency: (use latest available dependencies)
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>8.4.1.jre11</version>
</dependency>

 

Make sure to replace the version with the appropriate one compatible with your MSSQL Server version.

  1. To ensure that the MSSQL JDBC JAR is included in the build, open the core/pom.xml file and locate the <plugins> section.

  2. Add the maven-dependency-plugin to copy the MSSQL JDBC JAR to the target/classes directory. Modify the configuration section of the maven-dependency-plugin as follows:

 

<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>3.2.0</version> <executions> <execution> <id>copy-dependencies</id> <phase>process-resources</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <includeScope>runtime</includeScope> <outputDirectory>${project.build.directory}/classes/lib</outputDirectory> </configuration> </execution> </executions> </plugin>

 

durga_kavali
July 18, 2023

@tanika02 @rawvarun 

 

thanks for the reply.

 

i tried adding embedded dependency in all.pom.xml as follows

 

<embedded>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<target>/apps/test-vendor-packages/application/install</target>
</embedded>

also tried adding plugin and dependency in core/pom.xml.

 

still getting below error.

 

[ERROR] The analyser found the following errors for author and publish :
[ERROR] [api-regions-exportsimports] com.microsoft.sqlserver:mssql-jdbc:12.3.1: Bundle mssql-jdbc:12.3.1 is importing package(s) org.osgi.service.jdbc in start level 20 but no bundle is exporting these for that start level. (com.test:test.all:0.0.1-SNAPSHOT)

 

Thanks,

Durga Kavali.

nitesh_kumar-1
Adobe Employee
Adobe Employee
July 19, 2023

Your bundle "com.microsoft.sqlserver:mssql-jdb" is dependent on "org.osgi.service.jdbc", You need to include that as well, basically you need to include all the dependent bundles as well.

 

Hope that helps!

 

Regards,

Nitesh