Maven add dependencies from central repository to ADF project in JDeveloper

Chris VezalisDEVOPS, Maven, Oracle ADF

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.



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.

Chris Vezalis