Maven mysql driver

Avatar

Avatar

dilips50359074

Avatar

dilips50359074

dilips50359074

13-09-2019

Hi AEM guru's

i am using AEM Archtype 19 project.

I am using mySQL , I have downloaded https://dev.mysql.com/downloads/connector/j/  the driver from the location and installed it. 

Everything is working fine.

However what I am looking for is automated process when the maven will download the mySQL driver and install it in AEM and it should be visible in the bundles console.

I have copied the dependency (refer below) in the POM.xml.

<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->

<dependency>

    <groupId>mysql</groupId>

    <artifactId>mysql-connector-java</artifactId>

    <version>8.0.17</version>

</dependency>

What is see is the driver folder is downloaded in the following location C:\Users\Administrator\.m2\repository\mysql\mysql-connector-java

but when I install mvn clean install -PautoInstallPackage,   i do not see the driver (Oracle Corporation's JDBC and XDevAPI Driver for MySQLcom.mysql.cj) in the bundles.

am I missing something?

Regards

Dilip

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Jörg_Hoh

Employee

Total Posts

3.0K

Likes

916

Correct Answer

1.0K

Avatar

Jörg_Hoh

Employee

Total Posts

3.0K

Likes

916

Correct Answer

1.0K
Jörg_Hoh
Employee

15-09-2019

As said, you need to include it into your POM.

Jörg

Answers (3)

Answers (3)

Avatar

Avatar

Jörg_Hoh

Employee

Total Posts

3.0K

Likes

916

Correct Answer

1.0K

Avatar

Jörg_Hoh

Employee

Total Posts

3.0K

Likes

916

Correct Answer

1.0K
Jörg_Hoh
Employee

13-09-2019

You just declared the dependency, but you did not use it. If this driver is already bundled as OSGI service, you should add it to your ui.apps/pom.xml and declare it to be embedded into the content-package. Just like [1] but for the mysql driver.

[aem-project-archetype/pom.xml at aem-project-archetype-19 · adobe/aem-project-archetype · GitHub ]

Avatar

Avatar

dilips50359074

Avatar

dilips50359074

dilips50359074

15-09-2019

thanks for the response.

I am able to manually install the driver in the bundle.  What I am looking for is when I install my AEM archtype project, it should automatically install the mysql jdbc driver.

The links provided install it manually.  

Am i missing something?

Avatar

Avatar

scottm91515441

Avatar

scottm91515441

scottm91515441

15-09-2019

Wrap the Driver file into an OSGi bundle and deploy. This is shown in many articles:

Adobe Experience Manager Help | Querying MySQL data using an Adobe Experience Manager 6.4 DataSource...

As Joerg has pointed out - referencing the dependency in the POM file only ensures the build is created successfully - it does not place the driver file into an OSGi bundle and deploy to AEM.