Tuesday, June 9, 2015

Building ADF application using maven


In latest versions of JDeveloper, maven is supported out of the box. But, in older versions of JDeveloper (11g R1), it is not yet supported.

The details I will be giving in this post will be useful for the people who doesn't want to use Maven that comes out of the box with JDeveloper or to the people who are still using JDeveloper 11g R1 version.

I was architect for several ADF projects and wanted the ADF applications to build around continuous integration principles. We used Archiva as internal repository to store ADF artifacts.

Firstly, you need to identify the ADF libraries for the ADF application you are building.

How to identify the ADF libraries you need for the project to build?
When you create ADF project from JDeveloper, it adds all the ADF related libraries to the project. Some of them you don't need at all to run your application. The best way to identify is by removing them from the libraries and compiling the ADF application.

It looks simple, but depending on what components or java code you use it might end up tedious work. Once you identify the libraries, view each library and note down the location and upload it to the Archiva.

Screenshot of cleaned up libraries:



Uploading the artifacts to Archiva?
For every dependency library in Maven you need to have <artifactId> <groupId> and <version> number.
Oracle releases the libraries from release to release without making any changes to their versions, very few times they change the version. So, we came up with our own way to customize them in our archiva. Below is the standard we came up with.

groupId- oracle.adf.modules - This value remains same across all versions.
artifactId - jsf-ri - changes to the library
version - 11.1.1.6 - changes with the version you are using.

Below is the list of libraries I have identified in the ADF application we were using in our company. The ADF application we build doesn't have MDS customization's and Graphs.

<properties>
        <oracle.adf.version>11.1.2.4</oracle.adf.version>
        <oracle.adf.group.id>oracle.adf.modules</oracle.adf.group.id>
</properties>

<!-- Start Custom ADF Libraries -->
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-controller</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-controller-api</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-controller-rt-common</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-controller-security</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-dt-at-rt</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-faces-databinding-rt</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-pageflow-dtrt</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-pageflow-fwk</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-pageflow-impl</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-pageflow-rc</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-richclient-api</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-richclient-impl</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-share-base</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-share-ca</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-share-security</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-share-support</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adfdt_common</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adflibrary</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adflogginghandler</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adfm</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adfsharembean</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adftransactionsdt</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>cache</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>commons-el</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>db-ca</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>db-ca</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>glassfish.el</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>glassfish.jstl</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>groovy-all</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>identitystore</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>javax.activation</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>javax.jsp</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>javax.mail</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>javax.servlet</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>jdev-cm</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>jsf-api</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>jsp-el-api</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>ojmisc</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>oracle-el</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>trinidad-api</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>trinidad-impl</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>xmlparserv2</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- End ADF Libraries -->

Depending on the functionality you are using, you might have to add more artifacts to the above list. But, customizing them into above standards help you in migrating the libraries from one version to another.

I am attaching a sample pom file for reference:

<project xmlns="http://maven.apache.com/POM/4.0.0" xmlns:xsi="http://www.w3.com/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.com/POM/4.0.0 http://maven.apache.com/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.mycompany.my-portal</groupId>
        <artifactId>my-portal-parent</artifactId>
        <version>1.0.0-SNAPSHOT</version>
    </parent>
    <artifactId>my-portal-view</artifactId>
    <name>my-portal-view</name>
    <packaging>war</packaging>
    <description>This package contains my portal view files</description>
    <inceptionYear>2015</inceptionYear>
    <properties>
        <oracle.adf.version>11.1.2.4</oracle.adf.version>
        <oracle.adf.group.id>oracle.adf.modules</oracle.adf.group.id>
    </properties>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.1.1</version>
                <configuration>
                    <webXml>src\main\webapp\WEB-INF\web.xml</webXml>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <!-- Start Third party libraries -->
        <dependency>
            <type>jar</type>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.2</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>weblogic.portal</groupId>
            <artifactId>weblogic</artifactId>
            <version>10.3</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.persistence</groupId>
            <artifactId>persistence-api</artifactId>
            <version>1.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.0.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>weblogic.security</groupId>
            <artifactId>identity</artifactId>
            <version>10.3</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.4</version>
        </dependency>
        <dependency>
            <groupId>com.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.6.4</version>
            <scope>provided</scope>
        </dependency>
        <!-- Start Custom ADF Libraries -->
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-controller</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-controller-api</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-controller-rt-common</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-controller-security</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-dt-at-rt</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-faces-databinding-rt</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-pageflow-dtrt</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-pageflow-fwk</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-pageflow-impl</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-pageflow-rc</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-richclient-api</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-richclient-impl</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-share-base</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-share-ca</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-share-security</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adf-share-support</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adfdt_common</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adflibrary</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adflogginghandler</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adfm</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adfsharembean</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>adftransactionsdt</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>cache</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>commons-el</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>db-ca</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>db-ca</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>glassfish.el</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>glassfish.jstl</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>groovy-all</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>identitystore</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>javax.activation</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>javax.jsp</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>javax.mail</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>javax.servlet</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>jdev-cm</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>jsf-api</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>jsp-el-api</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>ojmisc</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>oracle-el</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>trinidad-api</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>trinidad-impl</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${oracle.adf.group.id}</groupId>
            <artifactId>xmlparserv2</artifactId>
            <version>${oracle.adf.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- End ADF Libraries -->
    </dependencies>
</project>
















1 comment:

  1. Hi Ram, we have developed DevOps solution to automate build and deploy processes. Check out http://flexagon.com/flexdeploy/. It has plugins for many Oracle Fusion Middleware products and it supports automated Build and Deploy of JDeveloper 11g and 12c based ADF applications as well. This is possible without any scripting. You can download Community Edition (Free) and try it yourself.

    ReplyDelete