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

Introduction

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.

Main article

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!

Add Your Comment