If you want to build an application to run on the Fusion Middleware platform, you may find that you want to use some Oracle provided JAR files in your build process. These may be things like API’s (interfaces) that are needed to compile, or client libraries that need to be bundled into the deployable application, or perhaps tools that are needed during build time, e.g. WLST or appc.
If you are using Maven to manage your build, it would be ideal to be able to use Maven coordinates to reference these Oracle artifacts, just like you do for any other kind of dependency. But Oracle does not provide POM files for these artifacts – so what can we do?
Maven provides the ability to load any artifact into a Maven repository and to give it a set of coordinates. This means that you can easily add the Oracle provided artifacts to your own Maven repository, or to a shared repository in your environment (e.g. a Maven Repository Manager) so that they can be used by yourself and other developers.
Maven will even generate the POM file for you, so all you need to do is create the coordinates. Normally coordinates follow the same reverse URL scheme that Java packages uses, but it might be a good idea not to use com.oracle in this case – as it is possible that Oracle might one day release their own POMs, and then you could have some name clashes. So it is probably better to use a different name, you might add ‘custom’ for example.
Suppose you want to add the wlthint3client.jar into your Maven environment, and give it the following coordinates:
- groupId: custom.com.oracle
- artifactId: wlthint3client
- versionId: 10.3.6
You could use a command like this (which would be entered all on one line):
mvn install:install-file -Dfile=/fmwhome/wlserver_10.3/server/lib/wlthint3client.jar -DgeneratePom=true -DgroupId=custom.com.oracle -DartifactId=wlthint3client -DversionId=10.3.6 -Dpackaging=jar
This will install the JAR into your local Maven repository. You can use a different goal to install into a remote repository (like a Maven Repository Manager for example). In this command you either need to give the repository URL in the url property, or specify the repositoryId the matches the repository definition in your Maven settings.xml.
mvn deploy:deploy-file -Dfile=/fmwhome/wlserver_10.3/server/lib/wlthint3client.jar -DgeneratePom=true -DrepositoryId=internal -DgroupId=custom.com.oracle -DartifactId=wlthint3client -DversionId=10.3.6 -Dpackaging=jar
After running these commands, you will have this artifact in your Maven repository and you will be able to use it like any other artifact. For example, to include it in a project as a dependency, you can just refer to it using its coordinates:
<dependency> <groupId>custom.com.oracle</groupId> <artifactId>wlthint3client</artifactId> <version>10.3.6</version> <packaging>jar</packaging> </dependency>
Armed with this knowledge you could go and create POMs for any Oracle (or other) artifacts that you want to use in your build. You could also create dependency hierarchies between them if you wanted or needed to.
All site content is the property of Oracle Corp. Redistribution not allowed without written permission