ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 45746] New: task sql with child fileset that has child include with if attribute could not work properly
Date Thu, 04 Sep 2008 17:01:09 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=45746

           Summary: task sql with child fileset that has child include with
                    if attribute could not work properly
           Product: Ant
           Version: 1.7.1
          Platform: PC
        OS/Version: Windows Vista
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Core tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: jiangjianbo@yahoo.com


my build.xml can not work properly, all attaches as below.

if I remove attribute "if" , it works OK. and the output as below :
-------
      [sql] connecting to jdbc:oracle:thin:@192.168.1.22:1521:ORCL
      [sql] Loading oracle.jdbc.driver.OracleDriver using AntClassLoader with
classpath ........
-------

if I remain attribute "if", but add code at position (1) in build.xml, the ant
not work, the output show same error.
---inserted code ----
                <property name="local.dbinit.exist1" value="true" />
                <property name="local.dbinit.exist2" value="true" />
                <property name="local.dbinit.exist3" value="true" />
                <property name="local.dbinit.exist4" value="true" />

--------

then I trace into ant's code, the last method code is below, and behavior ==
ADD, so if condition is false and fileset object ignored:
        void store(Object parent, Object child)
                throws InvocationTargetException, IllegalAccessException,
InstantiationException {
            if (behavior == ADD_CONFIGURED) { // real value of behavior is 1,
jumped
                istore(parent, child);
            }
        }

call stack is:
=>IntrospectionHelper$AddNestedCreator.store#1293
=>IntrospectionHelper$Creator.store#1201
=>UnknownElement.java#570

==========disk file tree (vista tree output)========
D:\work\platform\frrp
│  .project
│  .tomcatplugin
│  build-win.properties
│  build.properties
│  build.xml
│  hbm.properties
│      
├─design
│      db-frrp-oracle.sql
│      init-frrp.sql
│                      
└─work
        tldCache.ser



======================= my build.xml =========================================


        <!-- =================================
          target: dbinit
         ================================= -->
        <target name="dbinit" depends="_dbconfig" description="==> init and
load data">
                <echo message="LOAD DATA USING: ${db.driver}
${db.connection.url}" />
<!-- position (0), add debug code here -->
                <available property="local.dbinit.exist1" 
file="${output.db.script.dir}/db-${project.name}-${db.server.type}-extra.sql"
/>
                <available property="local.dbinit.exist2"
file="${output.db.script.dir}/db-${project.name}-extra.sql" />
                <available property="local.dbinit.exist3"
file="${output.db.script.dir}/init-${project.name}-${db.server.type}.sql" />
                <available property="local.dbinit.exist4"
file="${output.db.script.dir}/init-${project.name}.sql" />
                <sql driver="${db.driver}" url="${db.connection.url}"
userid="${db.user}" password="${db.pass}" onerror="continue">
                        <classpath refid="test-classpath" />
                        <fileset dir="${output.db.script.dir}">
                                <include
name="db-${project.name}-${db.server.type}-extra.sql"
if="${local.dbinit.exist1}" />
                                <include name="db-${project.name}-extra.sql"
if="${local.dbinit.exist2}" />
                                <include
name="init-${project.name}-${db.server.type}.sql" if="${local.dbinit.exist3}"
/>
                                <include name="init-${project.name}.sql"
if="${local.dbinit.exist4}" />
                        </fileset>
                </sql>
        </target>

<!-- _dbconfig only set some property value about jdbc and hibernate(it will
auto check hibernate version) -->
        <target name="_dbconfig" depends="__db_config,__init_hibernate">
        </target>

        <target name="__init_hibernate"
depends="___check_hibernate,___init_hibernate2,___init_hibernate3">
                <taskdef name="schemaexport"
classname="${db.hibernate.tool.package}.SchemaExportTask"
                                classpathref="hibernate_classpath" />
                <taskdef name="schemaupdate"
classname="${db.hibernate.tool.package}.SchemaUpdateTask"
                        classpathref="hibernate_classpath"/>

                <echo>use hibernate class:</echo>
                <echo> 
db.hibernate.schemaexporttask=${db.hibernate.tool.package}.SchemaExportTask</echo>
                <echo>  db.hibernate.dialect=${db.hibernate.dialect}</echo>
        </target>

    <target name="___check_hibernate" depends="_init_classpath">
                <available
classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask"
classpathref="classpath"
                        property="hibernate2_support" />
                <available
classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
classpathref="classpath"
                        property="hibernate3_support" />

                <path id="hibernate_classpath">
                        <path refid="classpath" />
                        <path location="${output.main.java.dir}" />
                        <path location="${src.main.java.dir}" />
                </path>
    </target>

    <target name="___init_hibernate2" depends="___check_hibernate"
if="hibernate2_support">
                <property name="db.hibernate.tool.package"
value="net.sf.hibernate.tool.hbm2ddl" />
        <property name="db.hibernate.dialect" value="${db.hibernate2.dialect}"
/>
    </target>

    <target name="___init_hibernate3" depends="___check_hibernate"
if="hibernate3_support">
                <property name="db.hibernate.schemaexporttask"
value="org.hibernate.tool.hbm2ddl.SchemaExportTask" />
        <property name="db.hibernate.dialect" value="${db.hibernate3.dialect}"
/>
    </target>

        <target name="__db_config" >
            <macrodef name="_set_db_properties">
                <attribute name="prefix" />
                <sequential>
                                <property name="db.server.address"
value="${@{prefix}.server.address}"  />
                                <property name="db.server.port"
value="${@{prefix}.server.port}" />
                                <property name="db.name"
value="${@{prefix}.name}" />
                                <property name="db.user"
value="${@{prefix}.user}" />
                                <property name="db.pass"
value="${@{prefix}.pass}" />
                                <property name="db.driver"
value="${@{prefix}.driver}" />
                                <property name="db.connection.url"
value="${@{prefix}.connection.url}" />
                        <property name="db.hibernate2.dialect"
value="${@{prefix}.hibernate2.dialect}" />
                        <property name="db.hibernate3.dialect"
value="${@{prefix}.hibernate2.dialect}" />
                </sequential>
            </macrodef>
                <_set_db_properties prefix="${db.server.type}" />

                <echo>use db configuration values:</echo>
                <echo>  db.server.address=${db.server.address}</echo>
                <echo>  db.server.port=${db.server.port}</echo>
                <echo>  db.name=${db.name}</echo>
                <echo>  db.user=${db.user}</echo>
                <echo>  db.pass=${db.pass}</echo>
                <echo>  db.driver=${db.driver}</echo>
                <echo>  db.connection.url=${db.connection.url}</echo>
        </target>

================output with -v =================================
Apache Ant version 1.7.1 compiled on June 27 2008
Buildfile: d:\work\platform\frrp\build.xml
Detected Java version: 1.6 in: C:\Program Files\Java\jdk1.6.0_05\jre
Detected OS: Windows Vista
parsing buildfile d:\work\platform\frrp\build.xml with URI =
file:/d:/work/platform/frrp/build.xml
Project base dir set to: d:\work\platform\frrp
[antlib:org.apache.tools.ant] Could not load definitions from resource
org/apache/tools/ant/antlib.xml. It could not be found.
 [property] Loading Environment env.
Property "env.windir" has not been set
[available] Unable to find dir ${env.windir} to set property os
Property "env.SHELL" has not been set
[available] Unable to find file ${env.SHELL} to set property os
 [property] Loading d:\work\platform\frrp\build-win.properties
 [property] Loading d:\work\platform\build-win.properties
Override ignored for property "SEAL_LIBRARY"
Override ignored for property "TOMCAT_HOME"
Override ignored for property "ANTLIB"
Override ignored for property "MAVEN_ANT_TASK_JAR"
Override ignored for property "COMMON_LIBRARY"
Override ignored for property "VSS_REPOSITORY_DIR"
Override ignored for property "DTD_DIR"
Override ignored for property "VSS_DIR"
Override ignored for property "PLATFORM_LIBRARY"
 [property] Loading d:\work\platform\frrp\build.properties
Override ignored for property "solution.dir"
 [property] Loading d:\work\platform\build.properties
Override ignored for property "mysql.driver"
Override ignored for property "mysql.hibernate2.dialect"
Override ignored for property "oracle.server.port"
Override ignored for property "oracle.user"
Override ignored for property "cvs.pass"
Override ignored for property "svn.host"
Override ignored for property "oracle.hibernate3.dialect"
Override ignored for property "svn.protocol.port"
Override ignored for property "postgresql.driver"
Override ignored for property "sqlserver.user"
Override ignored for property "depoly.dir"
Override ignored for property "postgresql.server.address"
Override ignored for property "sqlserver.driver"
Override ignored for property "tomcat.manager.url"
Override ignored for property "svn.latest.url"
Override ignored for property "cvs.protocol.port"
Override ignored for property "tomcat.port"
Override ignored for property "sqlserver.connection.url"
Override ignored for property "oracle.name"
Override ignored for property "oracle.pass"
Override ignored for property "output.webapp.work.dir"
Override ignored for property "hsqldb.hibernate2.dialect"
Override ignored for property "src.main.webapp.webinf.dir"
Override ignored for property "sqlserver.name"
Override ignored for property "sqlserver.pass"
Override ignored for property "solution.platform.webapp.dir"
Override ignored for property "postgresql.hibernate2.dialect"
Override ignored for property "sqlserver.hibernate3.dialect"
Override ignored for property "svn.protocol.type"
Override ignored for property "output.checkstyle.dir"
Override ignored for property "src.test.config.dir"
Override ignored for property "solution.platform.dir"
Override ignored for property "output.db.script.dir"
Override ignored for property "cvs.root"
Override ignored for property "compile.optimize"
Override ignored for property "postgresql.user"
Override ignored for property "sqlserver.server.port"
Override ignored for property "vss.user"
Override ignored for property "vss.bin.dir"
Override ignored for property "vss.path"
Override ignored for property "tomcat.password"
Override ignored for property "cvs.protocol.type"
Override ignored for property "tomcat.context.dir"
Override ignored for property "cvs.host"
Override ignored for property "sqlserver.server.address"
Override ignored for property "src.main.webapp.dir"
Override ignored for property "output.webapp.dir"
Override ignored for property "solution.output.dir"
Override ignored for property "postgresql.name"
Override ignored for property "postgresql.pass"
Override ignored for property "vss.pass"
Override ignored for property "output.dir"
Override ignored for property "vss.database"
Override ignored for property "oracle.connection.url"
Override ignored for property "mysql.hibernate3.dialect"
Override ignored for property "hsqldb.user"
Override ignored for property "tomcat.server"
Override ignored for property "mysql.user"
Override ignored for property "tomcat.username"
Override ignored for property "mysql.connection.url"
Override ignored for property "hsqldb.connection.url"
Override ignored for property "svn.user"
Override ignored for property "output.webapp.webinf.dir"
Override ignored for property "oracle.hibernate2.dialect"
Override ignored for property "oracle.driver"
Override ignored for property "svn.repository"
Override ignored for property "src.main.java.dir"
Override ignored for property "src.main.resource.dir"
Override ignored for property "svn.this.url"
Override ignored for property "src.test.java.dir"
Override ignored for property "output.main.test.dir"
Override ignored for property "cvs.repository"
Override ignored for property "postgresql.server.port"
Override ignored for property "hsqldb.name"
Override ignored for property "hsqldb.pass"
Override ignored for property "mysql.name"
Override ignored for property "project.name"
Override ignored for property "mysql.pass"
Override ignored for property "hsqldb.hibernate3.dialect"
Override ignored for property "svn.this.version"
Override ignored for property "oracle.server.address"
Override ignored for property "solution.dir"
Override ignored for property "svn.pass"
Override ignored for property "compile.debug"
Override ignored for property "postgresql.hibernate3.dialect"
Override ignored for property "output.main.java.dir"
Override ignored for property "hsqldb.driver"
Override ignored for property "db.server.type"
Override ignored for property "mysql.server.address"
Override ignored for property "sqlserver.hibernate2.dialect"
Override ignored for property "hsqldb.server.address"
Override ignored for property "output.junit.dir"
Override ignored for property "src.site.dir"
Override ignored for property "toolkit.dir"
Override ignored for property "output.javadoc.dir"
Override ignored for property "src.main.config.dir"
Override ignored for property "solution.config.dir"
Override ignored for property "compile.deprecation"
Override ignored for property "hsqldb.server.port"
Override ignored for property "postgresql.connection.url"
Override ignored for property "cvs.user"
Override ignored for property "scm.type"
Override ignored for property "src.test.resource.dir"
Override ignored for property "output.webapp.classes.dir"
Override ignored for property "output.webapp.lib.dir"
Override ignored for property "project.dir"
Override ignored for property "mysql.server.port"
[available] Unable to find file pom.xml to set property maven_support
Build sequence for target(s) `dbinit' is [__db_config, __init_maven_task,
__init_maven_1, __init_maven_2, _init_maven, _init_classpath,
___check_hibernate, ___init_hibernate2, ___init_hibernate3, __init_hibernate,
_dbconfig, dbinit]
Complete build sequence is [__db_config, __init_maven_task, __init_maven_1,
__init_maven_2, _init_maven, _init_classpath, ___check_hibernate,
___init_hibernate2, ___init_hibernate3, __init_hibernate, _dbconfig, dbinit,
init, compile, javadoc, build_webapp, copylib, _build_prop_jdbc, _init_dtd,
_init_xmltask, _change_web_xml_names, _frrp_config_web_xml, _frrp_build_config,
build_config, build, war, tomcat-install, checkstyle, tomcat-stop,
tomcat-start, pressure, tomcat-list, __init_vss, _vss_checkin, __init_svn,
compile_test, test, _hbm_prop_file, dbschema_all, dbdrop, manifest, dbcreate,
tomcat-remove, _svn_checkin, tomcat-remove-context, _init_checkstyle, _svn_get,
_vss_get, __init_cvs, _cvs_get, scm_get, _cvs_checkin, dbclean, native2ascii,
obfuscate, depoly_ftp, tomcat-install-context, _init_scm, dbinit2, dbupdate,
clean, copy_platform, dbschema, tomcat-reload, scm_checkin, _init_tomcat, jar,
_init_javadoc, ]

__db_config:
 [macrodef] creating macro  _set_db_properties
     [echo] use db configuration values:
     [echo]     db.server.address=192.168.1.22
     [echo]     db.server.port=1521
     [echo]     db.name=ORCL
     [echo]     db.user=test001
     [echo]     db.pass=test001
     [echo]     db.driver=oracle.jdbc.driver.OracleDriver
     [echo]     db.connection.url=jdbc:oracle:thin:@192.168.1.22:1521:ORCL

__init_maven_task:
parsing buildfile
jar:file:/D:/tools/dev/maven/apache-maven-2.0.9/lib/maven-ant-tasks-2.0.9.jar!/org/apache/maven/artifact/ant/antlib.xml
with URI =
jar:file:/D:/tools/dev/maven/apache-maven-2.0.9/lib/maven-ant-tasks-2.0.9.jar!/org/apache/maven/artifact/ant/antlib.xml
parsing buildfile
jar:file:/D:/tools/dev/maven/apache-maven-2.0.9/lib/maven-ant-tasks-2.0.9.jar!/org/apache/maven/artifact/ant/antlib.xml
with URI =
jar:file:/D:/tools/dev/maven/apache-maven-2.0.9/lib/maven-ant-tasks-2.0.9.jar!/org/apache/maven/artifact/ant/antlib.xml

__init_maven_1:
Skipped because property 'maven_support' not set.

__init_maven_2:
     [echo] not found pom.xml, MAVEN2 ignored

_init_maven:

_init_classpath:

___check_hibernate:
[available] Unable to load class org.hibernate.tool.hbm2ddl.SchemaExportTask to
set property hibernate3_support

___init_hibernate2:

___init_hibernate3:
Skipped because property 'hibernate3_support' not set.

__init_hibernate:
     [echo] use hibernate class:
     [echo]    
db.hibernate.schemaexporttask=net.sf.hibernate.tool.hbm2ddl.SchemaExportTask
     [echo]     db.hibernate.dialect=net.sf.hibernate.dialect.OracleDialect

_dbconfig:

dbinit:
     [echo] LOAD DATA USING: oracle.jdbc.driver.OracleDriver
jdbc:oracle:thin:@192.168.1.22:1521:ORCL
[available] Unable to find design\db-frrp-oracle-extra.sql to set property
local.dbinit.exist1
[available] Unable to find design\db-frrp-extra.sql to set property
local.dbinit.exist2
[available] Unable to find design\init-frrp-oracle.sql to set property
local.dbinit.exist3
[available] Found: design\init-frrp.sql
Property "local.dbinit.exist1" has not been set
Property "local.dbinit.exist2" has not been set
Property "local.dbinit.exist3" has not been set

BUILD FAILED
d:\work\platform\frrp\build.xml:705: Source file or resource collection,
transactions or sql statement must be set!
        at org.apache.tools.ant.taskdefs.SQLExec.execute(SQLExec.java:405)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
        at org.apache.tools.ant.Main.runBuild(Main.java:758)
        at org.apache.tools.ant.Main.startAnt(Main.java:217)
        at org.apache.tools.ant.Main.start(Main.java:179)
        at org.apache.tools.ant.Main.main(Main.java:268)

Total time: 23 minutes 27 seconds


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
Mime
View raw message