I am working on implementing secrets manager to etl pipeline. And for this I am using HikariDataSource but it throws following error:
In order to debug my code, I commented every bit of line except below and I am still getting error: missing or invalid dependency detected while loading class file 'HikariDataSourceFactory.class'
How can I get details of what is missing?
My code:
import com.miemo.commonlib.rdb.HikariDataSourceFactory
object RdbmsToSflake extends App with Logging {
val dataSourceFactory = new HikariDataSourceFactory {}
}
output for mvn compile:
[INFO] Building s3-to-dwh 0.1 [3/4]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ s3-to-dwh ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ s3-to-dwh ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- scala-maven-plugin:3.2.2:compile (default) @ s3-to-dwh ---
[WARNING] Expected all dependencies to require Scala version: 2.11.7
[WARNING] com.miemo:s3-to-dwh:0.1 requires scala version: 2.11.7
[WARNING] org.scoverage:scalac-scoverage-runtime_2.11:1.1.1 requires scala version: 2.11.7
[WARNING] org.scoverage:scalac-scoverage-plugin_2.11:1.1.1 requires scala version: 2.11.7
[WARNING] org.scalatest:scalatest_2.11:2.2.4 requires scala version: 2.11.2
[WARNING] Multiple versions of scala libraries detected!
[INFO] /Users/myusername/Documents/my-git-repo/my-repo/s3-to-dwh/src/main/scala:-1: info: compiling
[INFO] Compiling 2 source files to /Users/myusername/Documents/my-git-repo/my-repo/s3-to-dwh/target/classes at 1664178114387
[ERROR] error: missing or invalid dependency detected while loading class file 'HikariDataSourceFactory.class'.
[INFO] Could not access term zaxxer in package com,
[INFO] because it (or its dependencies) are missing. Check your build definition for
[INFO] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
[INFO] A full rebuild may help if 'HikariDataSourceFactory.class' was compiled against an incompatible version of com.
[ERROR] one error found
After debugging pom.xml, I got to find out that below plugin is messing somehow.
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<sourceDir>src/main/scala</sourceDir>
<args>
<arg>-Xlint:_</arg>
<arg>-language:postfixOps</arg>
</args>
</configuration>
</plugin>
Final Edit: @Tobias's answer helped me with this.
CodePudding user response:
there is a missing dependecy zaxxer in package com
announced in the maven log which you posted.
Can you add this to your maven pom and do a clean build?
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>3.4.5</version>
</dependency>