Cross platform Maven ADF JDeveloper 12c projects

Chris Vezalis DEVOPS, Maven, Oracle ADF Leave a Comment

When you create a new ADF project on JDeveloper 12c that supports Maven or convert a new project to support maven the JDeveloper wizard will add to project or application pom files ojmake and ojdeploy plugins for compile source code and generate jar, adf library jars, view controller war or ear file. If you are in a windows machine the JDeveloper create a plugin entry like the following:

<plugin>
       <groupId>com.oracle.adf.plugin</groupId>
       <artifactId>ojmake</artifactId>
       <version>12.1.3-0-0</version>
       <configuration>
         <ojmake>
           ${oracleHome}/jdeveloper/jdev/bin/ojmake.exe
         </ojmake>
         <files>
           ${basedir}/test-maven.jws
         </files>
         <usemaven>
           true
         </usemaven>
       </configuration>
       <executions>
         <execution>
           <phase>compile</phase>
           <goals>
             <goal>compile</goal>
           </goals>
         </execution>
       </executions>
     </plugin>

for Linux or Mac JDeveloper create the following:

<plugin>
        <groupId>com.oracle.adf.plugin</groupId>
        <artifactId>ojmake</artifactId>
        <version>12.1.3-0-0</version>
        <configuration>
          <ojmake>
            ${oracleHome}/jdeveloper/jdev/bin/ojmake
          </ojmake>
          <files>
            ${basedir}/Model.jpr
          </files>
          <usemaven>
            true
          </usemaven>
        </configuration>
        <executions>
          <execution>
            <phase>compile</phase>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

This files are depend to platform. This creates problems in multi platform development groups. For example if a developer creates a project from a windows machine and then commit in an SCM (svn, git etc) and one other developer checkout the project from a mac or linux machine the project will not run because jdeveloper will look for ojmake.exe and ojdeploy.exe.
ADF projects that jdeveloper creates depends on a parent pom called adf-parent pom. In that pom file the ojdeploy and ojmake are declared in the correct way for support multiplatform developer groups. The following is a part of that pom file that explains that maven can find the platform commands with no platform issues:

<profile>
      <id>windows</id>
      <activation>
        <os>
          <family>Windows</family>
        </os>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>com.oracle.adf.plugin</groupId>
              <artifactId>ojmake</artifactId>
              <version>12.1.3-0-0</version>
              <configuration>
                <ojmake>${oracleHome}/jdeveloper/jdev/bin/ojmake.exe</ojmake>
                <files>${basedir}/${project.artifactId}.jws</files>
                <usemaven>true</usemaven>
              </configuration>
              <executions>
                <execution>
                  <phase>compile</phase>
                  <goals>
                    <goal>compile</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
            <plugin>
              <groupId>com.oracle.adf.plugin</groupId>
              <artifactId>ojdeploy</artifactId>
              <version>12.1.3-0-0</version>
              <configuration>
                <ojdeploy>${oracleHome}/jdeveloper/jdev/bin/ojdeploy.exe</ojdeploy>
                <workspace>${basedir}/*.jws</workspace>
                <profile>${project.artifactId}-${project.version}</profile>
                <usemaven>true</usemaven>
              </configuration>
              <executions>
                <execution>
                  <phase>package</phase>
                  <goals>
                    <goal>deploy</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    <profile>
      <id>unix</id>
      <activation>
        <os>
          <family>unix</family>
        </os>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>com.oracle.adf.plugin</groupId>
              <artifactId>ojmake</artifactId>
              <version>12.1.3-0-0</version>
              <configuration>
                <ojmake>${oracleHome}/jdeveloper/jdev/bin/ojmake</ojmake>
                <files>${basedir}/${project.artifactId}.jws</files>
                <usemaven>true</usemaven>
              </configuration>
              <executions>
                <execution>
                  <phase>compile</phase>
                  <goals>
                    <goal>compile</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
            <plugin>
              <groupId>com.oracle.adf.plugin</groupId>
              <artifactId>ojdeploy</artifactId>
              <version>12.1.3-0-0</version>
              <configuration>
                <ojdeploy>${oracleHome}/jdeveloper/jdev/bin/ojdeploy</ojdeploy>
                <workspace>${basedir}/${project.artifactId}.jws</workspace>
                <profile>${project.artifactId}-${project.version}</profile>
                <usemaven>true</usemaven>
              </configuration>
              <executions>
                <execution>
                  <phase>package</phase>
                  <goals>
                    <goal>deploy</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>

So the JDeveloper wizards create platform dependent poms for ADF projects.
To create a cross platform ADF maven enabled project you need to remove the ojmake and ojdeploy paths from project pom files. JDeveloper can still find the commands on file system using the ADF parent pom file.
As an example for ojmake we need to remove this code part from ADF project pom or ADF application pom file:

<ojmake>
   ${oracleHome}/jdeveloper/jdev/bin/ojmake.exe
</ojmake>
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

Leave a Reply

avatar
  Subscribe  
Notify of