JDeveloper 12C, especially the version 12.2.1, has built in Maven support. This blog article shows how you can configure Maven in JDeveloper and create a new ADF application using Maven as build tool.

The configuration in JDeveloper can be done under Tools\Preferences. You can choose between the Maven JDeveloper Embedded Version and an external version.

JDeveloper Maven selection

Select a Maven version

Maven Build Lifecycle (Phases/Goals)

In Maven a build lifecycle is made up of phases. Each lifecycles is defined by a different list of build phases, wherein a build phase represents a stage in the lifecycle. In our example we will selected some default phases from the available lifecycle phases:

clean The files and directories created during the build will be deleted
compile Compile all the java source code in the src directory
package Take the compiled code and package it in its distributable format, such as a jar/war/ear as specified in your pom.xml
deploy Copies the final package to the remote repository for sharing with other developers and projects
Maven phases/goals

Selected Maven phases

Maven Repositories

You can specify the repositories to use for a group of projects by defining a repositories element at the top of your inheritance chain in the “settings.xml” witch will be find in “${user.home}/.m2/settings.xml”

Repository setting in settings-profile

Repository settings

And the remote repository will be displayed in the maven configuration window:

Repositories

Overview of remote repositories

Create an ADF Application with Maven as Build Tool

When you create a new ADF application you need to choose Maven as build tool in the last step of the wizard.

Wizard step - Use Maven

Use Maven dialog

The root pom (or workspace pom) can be found under Application Resources in the folder “Build Files”

Root pom

Location of the root pom

Run Maven phases

To run any maven phase you can right click on the root pom and then select Run Maven

Run Maven phases

Select Maven phases to run

In part 2 we will see how we can crate Maven build files (pom.xml) for existing ADF application in JDeveloper 12.2.1