In this part we will see how we can create Maven build files (pom.xml) for existing ADF applications in JDeveloper 12.2.1.
At first we will create a simple ADF application using JDeveloper 12.2.1, this simple application has a Model and ViewController project and is connected to a Database with HR-schema, but configured without any build tool (Ant,Maven..).
Steps To generate a Maven POM for the Application
New à From Galleryà Categories (Maven) àApplication POM. This will open the “Create a Maven POM for the Application” dialog, in which you specify values for the required elements for the pom.
|Group ID||Enter a unique identifier for the project, for example, root.
The POM’s Group ID, artifact ID and the version form the project’s fully qualified artifact name, in the form of <groupId>:<artifactId>:<version>.
|Artifact ID||Enter an identifier for the artifact that is unique within the group specified by the group ID, for example TestApp.
An artifact is something that is either produced or used by a project. Examples of artifacts produced by Maven for a project include JARs, source and binary distributions, and WARs.
|Version||Enter the current version of the artifact produced by this project|
|Packaging||Enter a valid packaging value. The valid packaging values are: pom, jar, Maven-plugin, war, ear, rar or other custom packaging types defined in JDeveloper. These define the default list of goals which execute to each corresponding build lifecycle stage for a particular package structure.|
|Generate POMs for Projects in this Application||If selected, JDeveloper will generate a POM for the projects in the application as well.|
|Include packaging plugin information (uses ojdeploy)||Select whether to include the ojdeploy plugin to the pom or not.|
|Include compile plugin information (uses ojmake)||Select whether to include the ojmake plugin to pom or not.|
The maven pom.xml file has been created for both the application (super pom) and projects (Model, ViewController).
The dependencies tab is use to describe all of the dependencies associated with a project. We use the maven dependency to specify a library containing the jar files required for building the project. For example we can see the generated dependencies for the “ViewController” project.
If you build a project with a dependency/plugin that does not exist in a local repository, Maven will search for it in the Remote repository defined in your „settings.xml“ (Maven in JDeveloper 12.2.1 – Part 1) and add it to your local repository. If the project is a Maven project (means the project has an associated pom file) and dependencies are added to the project, the changes are committed to the pom as well.
Note that sometimes when JDeveloper searchs for artifacts an error occurs.
And you will have to add your dependency/plugin manually like this: