on ‎2018 Jun 21 4:01 PM
Hello,
I am automating the below steps using maven plugins neo-java-web-maven and sql-maven-plugin via cloudbees Jenkins.
1. open-db-tunnel using neo-java-web-maven plugin
2. Then, create technical users in DB using sql-maven-plugin
The above steps are automated using maven plugins via
cloudbees Jenkins. The application and HANA DB are in SAP cloud platform.
The error in cloudbees jenkins is as follow,
[ERROR] Failed to execute goal org.codehaus.mojo:sql-maven-plugin:1.5:execute (default-cli) on project my-app: Driver class not found: com.sap.cloud.db.jdbc.Driver ->
Caused by: org.apache.maven.plugin.MojoExecutionException: Driver class not found: com.sap.cloud.db.jdbc.Driver
at org.codehaus.mojo.sql.SqlExecMojo.getConnection(SqlExecMojo.java:892)
at org.codehaus.mojo.sql.SqlExecMojo.execute(SqlExecMojo.java:612)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
Even though dependency(ngdbc) and driver class are provided, i get the above error. I am not sure, what i am missing in the POM.xml. I have attached the pom file. Could you kindly have a look whether it OK or something missing?
Cheers,
Request clarification before answering.
Hi Thaj,
I think I know where the problem is now.
1) You have defined the dependency outside of the sql-maven-plugin. You may need to move it into the plugin directive, right above the <configuration> tag.
2) You have mistakenly defined the HANA driver class with the same name as the ArtifactID for the jar dependency. Please use the following:
<driver>com.sap.db.jdbc.Driver</driver>
I tried to reproduce your issue on my machine. With that set I am now able to see the following:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building db-maven-connect 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- sql-maven-plugin:1.5:execute (default-cli) @ db-maven-connect ---
[INFO] 0 of 0 SQL statements executed successfully
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.104 s
[INFO] Finished at: 2018-06-28T14:43:18-03:00
[INFO] Final Memory: 11M/52M
[INFO] ------------------------------------------------------------------------
Problem now is I don't really know the sql-maven-plugin and why I have 0 of 0 SQL statements executed.
However, I believe the original issue is now gone, correct?
Regards,
Ivan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thaj,
No worries! Let me know once you have a solution and please share here.
I like the Spring Boot approach better. You could investigate it a bit...
https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-sql.html
You could create your data.sql as indicated here:
https://dzone.com/articles/spring-boot-and-spring-jdbc-with-h2
Regards,
Ivan
Hi Ivan,
Now SQL statement works.
When i set the goal as "sql:execute -P someprofileid" in Jenkins and POM is as below (default-cli is important to execute the SQL)
<executions>
<execution>
<id>default-cli</id>
<configuration>
<driver>com.sap.db.jdbc.Driver</driver>
<url>jdbc:sap://localhost:30015</url>
<username>${UserName}</username>
<password>${DBpassword}</password>
<autocommit>true</autocommit>
<sqlCommand>CREATE USER **** PASSWORD ****;</sqlCommand> </configuration> </execution> </executions>
</configuration>
Once again, I thank you for your swift reply and helping hand.
Cheers,
Thaj
| User | Count |
|---|---|
| 8 | |
| 5 | |
| 5 | |
| 4 | |
| 4 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.