Liquibase and Maven require the use of drivers to read your database. This topic walks you through the process of getting Oracle drivers while using Maven.
Add a dependency to the <dependencies>
section of the Maven pom.xml
, in your Maven project directory as follows:
<!-- https://mvnrepository.com/artifact/com.oracle.jdbc/ojdbc6 -->
<dependency>
<groupId>com.oracle.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>19.3.0.0</version>
</dependency>
Navigate to https://www.oracle.com/webapps/maven/register/license.html and log in. If you do not have an account, please create one at this time.
Update the settings.xml
file located in your Maven project directory to include the maven.oracle.com repository:
<repository>
<id>maven.oracle.com</id>
<name>oracle-maven-repo</name>
<url>https://maven.oracle.com</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
</repository>
Update your settings.xml
file located in your Maven project directory to include the maven.oracle.com pluginRepository.
<pluginRepository>
<id>maven.oracle.com</id>
<url>https://maven.oracle.com</url>
</pluginRepository>
Update your settings.xml
file in your Maven project directory to include the server for maven.oracle.com.
<server>
<id>maven.oracle.com </id>
<username>YOUR ORACLE USERNAME</username>
<password>YOUR ORACLE PASSWORD</password>
<configuration>
<basicAuthScope>
<host>ANY </host>
<port>ANY </port>
<realm>OAM 11g </realm>
</basicAuthScope>
<httpConfiguration>
<all>
<params>
<property>
<name>http.protocol.allow-circular-redirects </name>
<value>%b,true </value>
</property>
</params>
</all>
</httpConfiguration>
</configuration>
</server>
Create a settings-security.xml
file in your .m2 directory with your Oracle password in an encrypted format.
Example: {USER_HOME}/.m2/ directory.
mvn -encrypt-master-password <your_password>
settings-security.xml
file located in your .m2 folder:<settingsSecurity>
<master>{YOUR ENCRYPTED MASTER PASSWORD}</master>
</settingsSecurity>
Configure Maven with an HTTP Wagon compatible with maven.oracle.com.
MAVEN_HOME/lib/ext/
To verify the configuration is correct, run mvn compile
. If there are no errors stating that artifact com.oracle.jdbc cannot be
found in repo.maven.apache.org, then everything is configured correctly. If you are getting this error, make sure you have not omitted a step in these instructions.