ADF Projects often need jars from popular open source libraries and frameworks. JDeveloper supports the addition of dependencies from public (and private) repositories. To add a new dependency to project we need to:
Go to Project folder in Application browser and expand the Resources folder under Project. Then open pom.xml file and go to dependencies section. The click the Green + icon and select Add from Repository.
If this is the first time you add a dependency you may need to create an index for the repository. The index is useful for search for jars in repository through JDeveloper. You will see a warning like the following:
Click Yes. You will be transferred to Preferences page for generate the index for repository. Then select the repository (in our case the apache central repository) and click the “Index selected Repository Button”.
Then you need to wait for JDeveloper to download index data and unpack them to user .m2 folder. When downloading and unpack is complete you will see that the repository is indexed and the date time the index is completed at the status column.
Then click OK and go back to pom dependencies section again and click the add from repository button. You can now search the repository for the library or framework jar you need to include on your project. In our example we search for apache commons lang version 3. After you find the jar you need, select the jar you need to import and also select “Do not add reference to the current pom”. This option will not add the repository to pom. For apache central this option is not needed. At the end click the OK button.
You will see the dependency added in the dependencies section of pom file.
<dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.4</version> <scope>compile</scope> <type>jar</type> </dependency>
JDeveloper will also sync the dependency from maven with project file and you can see it in “Libraries and Classpath” section on Project properties. This is useful for run the project from inside the JDeveloper using the run button.
After that if dependency jar file is not already in your Maven local repository you need to execute Maven install goal in order for maven to download the jar and JDeveloper can see it in the local filesystem. After that you can add an import and write code to java files using the classes from downloaded library/framework jar.
- Using Ansible to install WebLogic 12c R2 and Fussion Middleware - November 9, 2015
- Using Ansible to configure an Oracle Linux 7.1 server with Oracle 12c R1 Enterprise Edition Database - October 22, 2015
- Ansible playbook to provision a WebLogic Fusion Middleware Domain on RHEL 7 - September 29, 2015