Difference between revisions of "EclipseLink/Examples/DBWS/DBWSBuilder using ANT and javac"

From Eclipsepedia

Jump to: navigation, search
(DBWSBuilder using ANT)
Line 21: Line 21:
 
     |  <span style="font-weight: bold;">dbws-builder.xml</span>
 
     |  <span style="font-weight: bold;">dbws-builder.xml</span>
  
==== <span style="font-size:5;font-family:monospace,sans-serif;">build.properties</span> ====
+
==== <span style="font-size:5;font-family:monospace,sans-serif;">dbws-builder.xml</span> ====
<source lang="text">
+
<source lang="xml">
custom = true
+
<?xml version="1.0" encoding="UTF-8"?>
build.sysclasspath=ignore
+
<dbws-builder xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 +
  <properties>
 +
    <property name="projectName">simpletable</property>
 +
    ... database properties
 +
  </properties>
  
stage.dir=${basedir}/stage
+
  <table
jlib.dir=${basedir}/jlib
+
    schemaPattern="SCOTT"
server.platform=wls
+
    tableNamePattern="SIMPLETABLE"
dbws.builder.file=dbws-builder.xml
+
  />
 +
</dbws-builder>
 
</source>
 
</source>
  
Line 63: Line 68:
 
</source>
 
</source>
  
==== <span style="font-size:5;font-family:monospace,sans-serif;">dbws-builder.xml</span> ====
+
==== <span style="font-size:5;font-family:monospace,sans-serif;">build.properties</span> ====
<source lang="xml">
+
<source lang="text">
<?xml version="1.0" encoding="UTF-8"?>
+
custom = true
<dbws-builder xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
build.sysclasspath=ignore
  <properties>
+
    <property name="projectName">simpletable</property>
+
    ... database properties
+
  </properties>
+
  
  <table
+
stage.dir=${basedir}/stage
    schemaPattern="SCOTT"
+
jlib.dir=${basedir}/jlib
    tableNamePattern="SIMPLETABLE"
+
server.platform=wls
  />
+
dbws.builder.file=dbws-builder.xml
</dbws-builder>
+
 
</source>
 
</source>
  
  
 
[[Category:EclipseLink/Example/DBWS|ANT Builder]]
 
[[Category:EclipseLink/Example/DBWS|ANT Builder]]

Revision as of 14:23, 8 August 2012

Contents

DBWSBuilder using ANT

This example illustrates how DBWSBuilder can be invoked from ANT generating all of the required aretfacts to the file system and then compiling and packaging with additional ANT targets.

File layout for this example:

Base directory
   \---jlib
   |
   |   eclipselink.jar
   |   eclipselink-dbwsutils.jar
   |   javax.servlet.jar
   |   javax.wsdl.jar
   |   ojdbc6.jar
   |   org.eclipse.persistence.oracleddlparser.jar
   |
   \---stage
   |   -- initially empty
   |
   |  build.properties
   |  build.xml
   |  dbws-builder.xml

dbws-builder.xml

<?xml version="1.0" encoding="UTF-8"?>
<dbws-builder xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <properties>
    <property name="projectName">simpletable</property>
    ... database properties
  </properties>
 
  <table
    schemaPattern="SCOTT"
    tableNamePattern="SIMPLETABLE"
  />
</dbws-builder>

build.xml

<?xml version="1.0"?>
<project name="simpletable" default="build">
  <property file="${basedir}/build.properties"/>
 
  <path id="build.path">
    <fileset
      dir="${jlib.dir}"
      includes="eclipselink.jar 
                eclipselink-dbwsutils.jar 
                org.eclipse.persistence.oracleddlparser.jar 
                javax.wsdl.jar 
                javax.servlet.jar 
                ojdbc6.jar"
      >
    </fileset>
  </path>
 
  <target name="build">
    <java
      classname="org.eclipse.persistence.tools.dbws.DBWSBuilder"
      fork="true"
      classpathRef="build.path"
      >
      <arg line="-builderFile ${dbws.builder.file} -stageDir ${stage.dir} -packageAs ${server.platform} ${ant.project.name}.war"/>
    </java>
  </target>
</project>

build.properties

custom = true
build.sysclasspath=ignore
 
stage.dir=${basedir}/stage
jlib.dir=${basedir}/jlib
server.platform=wls
dbws.builder.file=dbws-builder.xml