9 Customizing the Build Process with Maven POM Inheritance

Oracle provides a set of common parent Project Object Models (POMs) to enable easy customization of the build process for all projects targeted at a particular product, runtime environment, or for all projects targeted at Oracle Fusion Middleware.

Each of the Oracle-provided Maven archetypes have their parent POM set to an Oracle-provided common parent specific to the target runtime environment that the archetype is for, such as WebLogic Server and Coherence. The common parent POMs, one per product or target runtime environment, in turn have their parent POM set to an Oracle Fusion Middleware common parent.


Inheritance of POMs and Archetypes

The common POMs and Oracle-provided archetypes form the following inheritance hierarchy:

  • Provided by 12.1.2:

    - com.oracle.weblogic:wls-common:12.1.2-0-0
      - com.oracle.weblogic.archetype:basic-webapp:12.1.2-0-0
      - com.oracle.weblogic.archetype:basic-webapp-ejb:12.1.2-0-0
      - com.oracle.weblogic.archetype:basic-webservice:12.1.2-0-0
      - com.oracle.weblogic.archetype:basic-mdb:12.1.2-0-0
    - com.oracle.coherence:gar-common:12.1.2-0-0
      - com.oracle.coherence:maven-gar-archetype:12.1.2-0-0 
  • Provided by 12.1.3:

    - com.oracle.weblogic:wls-common:12.1.3-0-0
      - com.oracle.weblogic.archetype:basic-webapp:12.1.3-0-0
      - com.oracle.weblogic.archetype:basic-webapp-ejb:12.1.3-0-0
      - com.oracle.weblogic.archetype:basic-webservice:12.1.3-0-0
      - com.oracle.weblogic.archetype:basic-mdb:12.1.3-0-0
    - com.oracle.coherence:gar-common:12.1.3-0-0
      - com.oracle.coherence:maven-gar-archetype:12.1.3-0-0
    - com.oracle.soa:sar-common:12.1.3-0-0
      - com.oracle.soa.archetype:oracle-soa-application:12.1.3-0-0
      - com.oracle.soa.archetype:oracle-soa-project:12.1.3-0-0
    - com.oracle.servicebus:project:12.1.3-0-0
      - com.oracle.servicebus:sbar-project-common:12.1.3-0-0
      - com.oracle.servicebus.archetype:oracle-servicebus-project:12.1.3-0-0
      - com.oracle.servicebus:sbar-system-common:12.1.3-0-0
    - missing
      - com.oracle.adf.archetype:oracle-adffaces-ejb:12.1.3-0-0
  • Provided by 12.2.1:

    - com.oracle.weblogic:wls-common:12.2.1-0-0
      - com.oracle.weblogic.archetype:basic-webapp:12.2.1-0-0
      - com.oracle.weblogic.archetype:basic-webapp-ejb:12.2.1-0-0
      - com.oracle.weblogic.archetype:basic-webservice:12.2.1-0-0
      - com.oracle.weblogic.archetype:basic-mdb:12.2.1-0-0
    - com.oracle.coherence:gar-common:12.2.1-0-0
      - com.oracle.coherence:maven-gar-archetype:12.2.1-0-0
    - com.oracle.soa:sar-common:12.2.1-0-0
      - com.oracle.soa.archetype:oracle-soa-application:12.2.1-0-0
      - com.oracle.soa.archetype:oracle-soa-project:12.2.1-0-0
    - com.oracle.servicebus:project:12.2.1-0-0
      - com.oracle.servicebus:sbar-project-common:12.2.1-0-0
      - com.oracle.servicebus.archetype:oracle-servicebus-project:12.2.1-0-0
      - com.oracle.servicebus:sbar-system-common:12.2.1-0-0
    - missing
      - com.oracle.adf.archetype:oracle-adffaces-ejb:12.2.1-0-0

Customizing the Build Process

If you want to customize your build process, for example, setting some default properties, setting up default settings for a particular plug-in, or defining Maven profiles, then you can add your definitions to the appropriate parent POM.

For example, if you add definitions to com.oracle.weblogic:wls-common:12.2.1-0-0, all projects associated with this parent are affected, which includes all projects that you have created from the WebLogic Maven archetypes (unless you modify their parents) and projects that you have created manually.

Doing this minimizes the number of settings needed in each project POM. For example, if you are going to deploy all of builds to the same test server, then you can provide the details for the test server by adding the appropriate build, plug-ins, and plug-in section for com.oracle.weblogic:wls-maven-plugin:12.2.1-0-0 as shown in the following example of a customized parent WebLogic POM:

<project xmlns="http://maven.apache.org/POM/4.0.0"
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

Similarly, if you want to affect all projects targeted at any Oracle Fusion Middleware runtime, place your customizations in com.oracle.maven:oracle-common:12.2.1-0-0.

If you are using a shared internal repository, then after you customize the parent POMs, publish them into your shared Maven repository or repositories.

To see how these customizations are brought into your projects, you can use the following command, from your project's directory, to see the full POM that will be used to build your project:

mvn help:effective-pom

If you want to define more than one set of shared properties in the parent POM, for example, one set for your test environment, and one for your QA environment, Oracle encourages you to explore the use of Maven profiles. See:


Profiles enable you to switch various settings on for a particular build by setting a command-line argument, or based on the presence or absence of various properties in the POM.