Fixes bug 40047: include wstx-asl-3.0.2.jar in the classpath on database export
authorCarlos Aristu <carlos.aristu@openbravo.com>
Thu, 31 Jan 2019 19:19:21 +0100
changeset 35385 aaa984886667
parent 35384 6d346acd0ba3
child 35408 21f22c413076
Fixes bug 40047: include wstx-asl-3.0.2.jar in the classpath on database export

- Execute ant export.database and export.sample.data as forked tasks in order to define the classpath of those tasks with the required libraries. This way, it will be no longer needed to manually copying wstx-asl-3.0.2.jar inside Ant folder to get the xml headers of the database model files with single quotes.

- Besides, the runtime-classpath now includes the Tomcat pool libraries. Therefore these tasks now use it to retrieve the DB connections. Otherwise, the default Hibernate pool would be used, forcing to explicitly close it within the tasks as we do here[1].

- Updated dbsourcemanager.jar with the changes in DBSourceManager.

[1] https://code.openbravo.com/erp/devel/pi/rev/3ed849d672ae34b8bcec1d16aaea800ea68e5c61
src-db/database/build.xml
src-db/database/lib/dbsourcemanager.jar
--- a/src-db/database/build.xml	Tue Jan 29 23:14:28 2019 +0530
+++ b/src-db/database/build.xml	Thu Jan 31 19:19:21 2019 +0100
@@ -12,7 +12,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2001-2018 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -40,6 +40,7 @@
     <dirset dir="${base.modules}">
       <include name="*/build/classes/" />
     </dirset>
+    <fileset dir="${base.modules}" includes="org.openbravo.apachejdbcconnectionpool/lib/runtime/*.jar" />
     <pathelement path="${basedir}/../../src-util/modulescript/build/classes/" />
     <fileset dir="./lib">
       <include name="**/*.jar" />
@@ -75,8 +76,7 @@
     <antcall target="database.postupdate.${bbdd.rdbms}" />
     <antcall target="update.dbupdate.timestamp" />
   </target>
-  
-  
+
   <target name="update.database.java">
     <java classname="org.openbravo.ddlutils.task.AlterDatabaseJava" failonerror="true" fork="true" maxmemory="${build.maxmemory}">
       <arg value="${bbdd.driver}"/>
@@ -118,19 +118,44 @@
   </target>
 
   <target name="export.database.structure">
-      <taskdef name="exportdatabase" classname="org.openbravo.ddlutils.task.ExportDatabase">
-        <classpath refid="runtime-classpath" />
-      </taskdef>
-      <exportdatabase driver="${bbdd.driver}" url="${bbdd.owner.url}" user="${bbdd.user}" password="${bbdd.password}" excludeobjects="com.openbravo.db.OpenbravoExcludeFilter" model="model" moduledir="${base.modules}" output="sourcedata" userId="0" adminMode="true" propertiesFile="${base.config}/Openbravo.properties" force="${force}" validateModel="${validate.model}" testAPI="${isMinorVersion}" datasetList="AD,ADRD" rd="${rd}" checkTranslationConsistency="${checkTranslationConsistency}" threads="${max.threads}"/>
-      <antcall target="update.dbupdate.timestamp" />
+    <java classname="org.openbravo.ddlutils.task.ExportDatabase" failonerror="true" fork="true" maxmemory="${build.maxmemory}">
+      <arg value="${bbdd.driver}"/>
+      <arg value="${bbdd.owner.url}"/>
+      <arg value="${bbdd.user}"/>
+      <arg value="${bbdd.password}"/>
+      <arg value="${base.modules}"/>
+      <arg value="${base.config}/Openbravo.properties" />
+      <arg value="${force}"/>
+      <arg value="${validate.model}"/>
+      <arg value="${isMinorVersion}"/>
+      <arg value="${rd}"/>
+      <arg value="${checkTranslationConsistency}"/>
+      <arg value="${max.threads}"/>
+      <classpath refid="runtime-classpath"/>
+      <syspropertyset>
+         <propertyref name="java.security.egd" />
+      </syspropertyset>
+    </java>
+    <antcall target="update.dbupdate.timestamp" />
   </target>
 
-
   <target name="export.sample.data">
-    <taskdef name="exportsampledata" classname="org.openbravo.ddlutils.task.ExportSampledata">
-      <classpath refid="runtime-classpath" />
-    </taskdef>
-    <exportsampledata driver="${bbdd.driver}" url="${bbdd.owner.url}" user="${bbdd.user}" password="${bbdd.password}" basedir="${basedir}/../../" client="${client}" module="${module}" rdbms="${bbdd.rdbms}" exportFormat="${exportFormat}" threads="${max.threads}"/>
+    <java classname="org.openbravo.ddlutils.task.ExportSampledata" failonerror="true" fork="true" maxmemory="${build.maxmemory}">
+      <arg value="${bbdd.driver}"/>
+      <arg value="${bbdd.owner.url}"/>
+      <arg value="${bbdd.user}"/>
+      <arg value="${bbdd.password}"/>
+      <arg value="${bbdd.rdbms}"/>
+      <arg value="${basedir}/../../"/>
+      <arg value="${client}"/>
+      <arg value="${module}"/>
+      <arg value="${exportFormat}"/>
+      <arg value="${max.threads}"/>
+      <classpath refid="runtime-classpath"/>
+      <syspropertyset>
+         <propertyref name="java.security.egd" />
+      </syspropertyset>
+    </java>
   </target>
 
   <target name="import.sample.data">
Binary file src-db/database/lib/dbsourcemanager.jar has changed