In this [POST] I have explained for example:
- How to use the local Maven Repository to push/get Oracle Jdbc drivers; The default path value is ${user.home}/.m2/repository/.
- Hot to use the remote Maven Repository on DevCS (Developer Cloud Service) to push/get Oracle Jdbc drivers
Now is time to introduce the maven.oracle.com: (Oracle documentation)
Suppose that you are developing an application that requires and uses Oracle Jdbc Driver ojdbc7.jar, and that you would like to get it directly from internet from the remote Maven Repository maven.oracle.com.
We need to write/update 2 files:
- pom.xml (inside your maven project)
- settings.xml
- this file is inside the conf directoy of your maven installation.
- can be also in ${user.home}/.m2/) - Tools like Eclipse are searching it in this directory
To access to the Oracle Maven Repositoy - maven.oracle.com you need an user and a password, if you are already registered on OTN - Oracle Technology Network you can use the same user and password.
For the autentication we need to use HTTP Wagon, this is already inside Maven:
You must verify that the Maven that you are using has in his lib directory the wagon-http-shared-x.xx.jar and that the version (x.xx) is > 2.8
For examples I have installed Maven 3.3.9 and I'm using wagon-http-shared-2.10.jar.
If you are using an old version of Maven you cal download the HTTP Wagon (2.8) from [HERE] and put the jar in MAVEN_HOME/lib/ext/.
This is a sample of minimal pom.xml that you must use for example to get from the remote maven.oracle.com the ojdbc7.jar version 12.1.0.2
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>demo</groupId>
<artifactId>maven1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<repositories>
<repository>
<id>maven.oracle.com</id>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>https://maven.oracle.com</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>maven.oracle.com</id>
<url>https://maven.oracle.com</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>com.oracle.jdbc</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>
</dependencies>
</project>
You must write also a settings.xml where you must insert your user and password:
edit your settings.xml that is inside the directory MAVEN_HOME/conf:
<!-- servers
| This is a list of authentication profiles, keyed by the server-id used within the system.
| Authentication profiles can be used whenever maven must make a connection to a remote server.
|-->
<servers>
<server>
<id>maven.oracle.com</id>
<username>username</username>
<password>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>
</servers>
That's all :)
Now some Tips & Tricks:
- Setting a proxy in Maven
- Setting your Maven installation on Eclipse
- Browsing the remote maven.oracle.com
- [1] - If you are using a proxy update the pre-configured part <proxies>...</proxies> in the file settings.xml
- [2] - If you are working with Eclipse and you have also maven installed it is convenient to says to Eclipse to use your maven installation and not the embedded one.
How to use from Eclipse an external maven installation:
I have created a simple maven project and I have dragged inside the previous described pom.xml file with the ojdbc7 dependency:
Righy click with the mouse on the pom.xml file and select: Run As-> Maven build ...
Choose a name (maven1 - package) and a Goal (package):
As you can see we are using the embedded Maven Runtime, click on Configure to change it:
Click the Add button:
Select the Directory where you have installed Maven on your local disk:
Click on Finish:
Check only the local maven installation:
Click on Apply then on OK:
Now your maven Runtime is changed, you can click on Run to execute the package goal:
In the console you can see that you are dowloading some files:
If you go in the ${user.home}/.m2/repository/ directory you can find what you have downloaded:
- [2] - How to browse the remote maven.oracle.com:
I suggest to use: Nexus Repository OSS - I have downloaded and installed the version : nexus-2.12.1-01-bundle.zip (light, fast and simple)
Unzip it in a directory:
Go into the directory nexus-2.12.1-01:
Open a Command Console and execute "nexus console", this will start an http server on port 8081:
Open in a Broser the URL: http://localhost:8081/nexus
Login with the default user admin/admin123:
Click the Add button and select Add Proxy Repository:
Copy the following configuration (next 2 images) and insert your OTN User and Password:
Now you can browse the repository maven.oracle.com:
You can also search on it, try to search ojdbc7:
</end>
Hybrid LSTM and Encoder Decoder Architecture for Detection of Image Forgeries Project For CSE
RispondiEliminaHyperspectral Image Unmixing With End member Bundles and Group Sparsity Inducing Mixed Norms Project For CSE
Iterative Residual Network for Deep Joint Image Demosaicking and Denoising Project For CSE
JigsawNet Shredded Image Reassembly Using Convolutional Neural Network and Loop based Composition Project For CSE
Joint Image Deconvolution and Separation Using Mixed Dictionaries Project For CSE