For ages, software companies have had maven repositories to manage their artifacts. Using maven’s dependencies system, you can easily add new libraries to your project without needing to know which other libraries you needed and maven will even download them for you. So the times of adding a library…compiling…class-not-found…adding another library…compiling…next-class-not-found where over. Unless you needed some oracle libraries!
Up to now, Oracle did not have a public repository so when we needed libraries, you had to download the libraries yourself and stick them into your local repository. Or use the tool provided by Oracle to do this for you see last part of this weblog. But with the coming of the 12C version where Oracle has gotten more Maven enabled, it would not be long before the Oracle maven repository would come to life and taataaaaaa! Oracle now has a maven repository: http://maven.oracle.com. You will have to register/login and accept the user terms before you can access the repository. The repository only holds release-level artifacts, such as 12.1.2 and 12.1.3 for now.
Lets see if it works connecting straight to the Oracle repository using maven. Download Maven 3.2.5 or later as only these versions are supported by the repository it seems. Go to settings.xml and add the oracle server to the servers section.
maven.oracle.com YOURUSERNAME YOURPASSWORD ANY ANY OAM 11g http.protocol.allow-circular-redirects %b,true
Now go to a 12C service bus project you have lying around and add the next section to your pom.xml:
maven.oracle.com true false https://maven.oracle.com default maven.oracle.com https://maven.oracle.com
Now we have configured the Oracle repository for the project and in the maven config we have set the password. So lets do a mvn clean and see if the dowloads starts…..
D:\Amazon EC2\SVN\trunk\osb\HelloService_1.0>mvn clean [INFO] Scanning for projects... Downloading: https://maven.oracle.com/com/oracle/servicebus/sbar-project-common/12.1.3-0-0/sbar-project-common-12.1.3-0-0.pom Downloaded: https://maven.oracle.com/com/oracle/servicebus/sbar-project-common/12.1.3-0-0/sbar-project-common-12.1.3-0-0.pom (0 B at 0.0 KB/sec) Downloading: https://maven.oracle.com/com/oracle/servicebus/client/maven-metadata.xml Downloaded: https://maven.oracle.com/com/oracle/servicebus/client/maven-metadata.xml (381 B at 0.2 KB/sec) Downloading: https://maven.oracle.com/com/oracle/weblogic/weblogic-server-pom/maven-metadata.xml ... Downloaded: https://maven.oracle.com/com/oracle/servicebus/core/module-common/maven-metadata.xml (393 B at 0.2 KB/sec) Downloading: https://maven.oracle.com/com/oracle/servicebus/core/module-configfwk/maven-metadata.xml Downloaded: https://maven.oracle.com/com/oracle/servicebus/core/module-configfwk/maven-metadata.xml (396 B at 0.1 KB/sec) Downloading: https://maven.oracle.com/com/oracle/servicebus/core/module-kernel-api/maven-metadata.xml Downloaded: https://maven.oracle.com/com/oracle/servicebus/core/module-kernel-api/maven-metadata.xml (397 B at 0.2 KB/sec) [WARNING] [WARNING] Some problems were encountered while building the effective model for nl.redrock:HelloService_1.0:sbar:1.0-SNAPSHOT [WARNING] 'parent.relativePath' points at RR-ServiceBusApplication:RR-ServiceBusApplication instead of com.oracle.servicebus:sbar-project-common, please verify your project structure @ line 6, column 13 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building HelloService_1.0 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ HelloService_1.0 --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 09:58 min [INFO] Finished at: 2015-01-14T20:00:20+01:00 [INFO] Final Memory: 9M/120M [INFO] ------------------------------------------------------------------------ D:\Amazon EC2\SVN\trunk\osb\HelloService_1.0>
So perfect….it works!
The next thing we want to do is proxy the repository in your Nexus for example. We can add the server in Nexus but we can’t seem to browse it. After some looking around it seems a lot of repository managers can’t handle the authentication way of the Oracle repository and have to be patched. See a comment of Mark Nelson about this:
“Hi Folks,
We are aware that some of you would want to proxy the Oracle Maven Repository with repository managers like Artifactory and Nexus. We have tested the three common ones, and found that they all need small patches to understand the authentication we are using. We are working with them to patch these issues. We will let you know the JIRA ID’s for these issues when they are available. If you want to help, you can upvote the issues, or if you are using commercial versions, you could contact your representative to let them know you want these patches.
Best regards,
Mark Nelson
So work in progress but definately a step in the right direction!
References:
- http://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9010
- https://community.oracle.com/community/fusion_middleware/maven
Why the total time of this building was so high?
9 minutes to build an Hello World Service is not acceptable at all.
And about these errors:
[WARNING] Some problems were encountered while building the effective model for nl.redrock:HelloService_1.0:sbar:1.0-SNAPSHOT
[WARNING] ‘parent.relativePath’ points at RR-ServiceBusApplication:RR-ServiceBusApplication instead of com.oracle.servicebus:sbar-project-common, please verify your project structure @ line 6, column 13
Should they be fixed?
Sorry for being so straightforward, but I have the same problems in my environment right now which are a long time for building and those error messages in the log.
Do you have any idea how to speed up it?
Thank you
Hi Victor,
It looks like it still had to download some of the artifacts which took quite some time. Normally our Maven build of a simple OSB service takes much less time.
The warnings during build isn’t something to worry about imho….it’s a warning and not an error so not blocking for the build. I guess Oracle hasn’t gotten the Maven builds quite right yet.
regards,
Hugo