Maven add dependencies from central repository to ADF project in JDeveloper

Chris Vezalis DEVOPS, Maven, Oracle ADF 4 Comments

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.

add-dep-from-repo

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:

no-repo-index-found

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”.

create-repo-index

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.

repo-indexed

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.

search-dep-central

You will see the dependency added in the dependencies section of pom file.

dep-added-pom

<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.

verify-dep-lib-classpath

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

Chris Vezalis

Senior Software Engineer at Nodalpoint
Active in IT since 2000.
My areas of expertise are Oracle Middleware Products (WebLogic, ADF, SOA Suite), Linux, JAVA, JavaScript and DevOps.
Chris Vezalis

4
Leave a Reply

avatar
3 Comment threads
1 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
4 Comment authors
Kai MoellerAnkurChris VezalisAli Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Ali
Guest
Ali

Thanks for your great post. I have got a question on managing local dependencies using MAVEN. I have got a large application which is decomposed to smaller modules and there is inter-dependency between these modules, now how can we manage these dependencies using MAVEN?
regards

Ankur
Guest
Ankur

thanks for this information

Kai Moeller
Guest
Kai Moeller

I have come across this great article when I tried to use Maven integration with ADF. Problem is, I do not get the libraries synced from the POM dependencies into the project properties (and so, at development time, no imports are getting resolved). Weather I see a hint on the libraries tab “Managed by Maven” or simply nothing, depending on application setup. What am I missing? JDev 12.2.1.3.0