Using Oracle Service Registry in an automated (Maven) SOA/BPM build

Today, I feel very privileged to share with you a post from one of my readers, Phani Khrisna, who was kind enough to allow me to post this updated Maven POM which allows you to use resources in the Oracle Service Registry during the build.

Phani has also tidied up a small omission from earlier POMs, which a number of you have commented on.  This POM copies the SAR file into the target directory so that it will be published into the Maven repository as part of the build, rather than an almost empty file with the POM in it.  While we may not be able to use it as a dependency in another composite using just the Maven coordinates (like we can with Java artifacts for example), it at least makes it available to other developers.

<?xml version="1.0" encoding="windows-1252" ?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.phani..AgentDataService</groupId>
  <artifactId>GetAgentData</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <scm>
    <connection>scm:svn://x.x.x.x/repo/AgentService/trunk/SOAComposite</connection>
    <developerConnection>scm:svn://x.x.x.x/repo/AgentService/trunk/SOAComposite</developerConnection>
  </scm>
  <build>
    <sourceDirectory>src/</sourceDirectory>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.1</version>
        <executions>
          <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>SCA-INF/src</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.0.2</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.6</version>
        <executions>
          <execution>
            <id>sca-compile</id>
            <phase>compile</phase>
            <configuration>
              <target>
                <property name="parent" location=".." />
                <property name="scac.input" value="composite.xml" />
                <property name="oracle.soa.uddi.registry.inquiryUrl" value="http://gh123:7101/registry/uddi/inquiry" />
                <ant antfile="${scriptsdir}/ant-sca-compile.xml"
                     dir = "${scriptsdir}"
                     target="scac" />
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
          <execution>
            <id>sca-package</id>
            <phase>package</phase>
            <configuration>
              <target>
                <property name="parent" location=".." />
                <property name="oracle.soa.uddi.registry.inquiryUrl" value="http://gh123:7101/registry/uddi/inquiry" />
                <property name="build.compiler" value="extJavac"/>
                <property name="compositeName" value="${project.artifactId}" />
                <property name="compositeDir" value="${basedir}" />
                <property name="revision" value="${project.version}" />
                <ant antfile="${scriptsdir}/ant-sca-package.xml"
                     dir = "${scriptsdir}"
                     target="package" />
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
		  <execution>
            <id>sca-copy-jar</id>
            <phase>package</phase>
            <configuration>
              <target>
                 <copy file="${basedir}/deploy/sca_${project.artifactId}_rev${project.version}.jar" tofile="${basedir}/target/${project.artifactId}-${project.version}.jar"/>
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
          <execution>
            <id>sca-deploy</id>
            <phase>deploy</phase>
            <configuration>
              <target>
                <property name="serverURL" value="http://gh345:7011" />
                <property name="user" value="weblogic" />
                <property name="password" value="password1" />
                <property name="sarLocation" value="${basedir}/deploy/sca_${project.artifactId}_rev${project.version}.jar" />
                <property name="overwrite" value="true" />
                <property name="forceDefault" value="true" />
                <property name="partition" value="default" />
                <ant antfile="${scriptsdir}/ant-sca-deploy.xml"
                     dir="${scriptsdir}"
                     target="deploy" />
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
          <execution>
            <id>sca-test</id>
            <phase>deploy</phase>
            <configuration>
              <target>
                <property name="parent" location=".." />
                <property name="jndi.properties.input" value="sca-test.jndi.properties" />
                <property name="scatest.input" value="AgentData" />
                <property name="scatest.format" value="junit" />
                <property name="scatest.result" value="reports" />
                <ant antfile="${scriptsdir}/ant-sca-test.xml"
                     dir="${scriptsdir}"
                     target="test" />
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <outputDirectory>SCA-INF\classes/</outputDirectory>
    <resources/>
  </build>
  <distributionManagement>
    <!-- use the following if you're not using a snapshot version. -->
    <!--<repository>
      <id>local</id>
      <name>local repository</name>
      <url>file:///C:/Documents and Settings/Phani/.m2/repository</url>
    </repository> -->
    <snapshotRepository>
      <id>artifactory</id>
      <name>artifactory-snapshots</name>
      <url>http://portalserver:8081/artifactory/libs-snapshot-local</url>
    </snapshotRepository>
  </distributionManagement>
</project>

</project>

Thank you Phani.  Enjoy!

About Mark Nelson

Mark Nelson is a Consulting Solution Architect in the Fusion Middleware Architects Team (known as ”The A-Team”) in Oracle Development. Their mission is to supply deep technical expertise to support customers deploying Oracle Fusion Middleware, and to collect real world feedback to continuously improve the product set. Mark spends most of his time working on development lifecycle, SOA and BPM. Before joining Oracle Development in 2010, Mark worked in Sales Consulting at Oracle since 2006 and various roles at IBM since 1994, including several in Software Group and System/390 Group across Asia Pacific.
This entry was posted in group1, Uncategorized and tagged , , , , , , . Bookmark the permalink.

2 Responses to Using Oracle Service Registry in an automated (Maven) SOA/BPM build

  1. jvzoggel says:

    Thanx for sharing Phani and Mark. Really nice and helpfull example.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s