ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Taemin Cim" <qwertypo...@hotmail.com>
Subject RE: AW: Broken Junit targets
Date Thu, 16 Feb 2006 02:51:45 GMT
Hi All,

Thanks so much for your help so far!  But the saga continues...
I tried Jans approach, as well as some others.
Steve suggested the -v option, so I'm going to lay it all out here.
There is four parts to this e-mail:
  Ant's output,
  build.xml
  properties.xml
  build.properties

I do feel a little awkward exposing my ineptitudes to the world like this.  
As although I use Ant, Junit and Java on Linux, I don't really understand 
everything about taskdefs, classloaders and bash, because when things work, 
I stick to the programming.

  One more thing:  When I type export $CLASSPATH, I get
bash: export: 
':/home/timmy/junit3.8.1/junit.jar:/home/timmy/packages/hibernate-extensions-2.1.3/tools:/home/timmy/packages/hibernate-3.0/lib:/home/timmy/packages/mysql-connector-java-3.0.17-ga':

not a valid identifier

Should I be worried about the "not a valid identifier' part?


Ant&#347; output:
------------
Apache Ant version 1.6.5 compiled on June 2 2005
Buildfile: build.xml
Detected Java version: 1.4 in: /usr/java/j2sdk1.4.2_08/jre
Detected OS: Linux
parsing buildfile /home/timmy/projects/applabsuser/build.xml with URI = 
file:///home/timmy/projects/applabsuser/build.xml
Project base dir set to: /home/timmy/projects/applabsuser
resolving systemId: file:///home/timmy/projects/applabsuser/properties.xml
Property ${dist.dir} has not been set
[property] Loading Environment env.
Override ignored for property ant.home
[property] Loading /home/timmy/projects/build.properties
[property] Unable to find property file: 
/home/timmy/projects/build.properties
[property] Loading /home/timmy/projects/lib/lib.properties
[property] Unable to find property file: 
/home/timmy/projects/lib/lib.properties
Property ${checkstyle.version} has not been set
Property ${checkstyle.version} has not been set
Build sequence for target(s) `test-batch' is [init, resources, 
test-resources, compile, test-init, test-compile, test-batch]
Complete build sequence is [init, resources, test-resources, compile, 
test-init, test-compile, test-batch, test-summary, setup-path, test-brief, 
javadoc, test, clean, dist, junit-commandline, test-xml, ]

init:
     [echo] Building AppLabsUser
     [echo] /////////////////////////////////////////////////////

resources:
     [echo] Copying Resources
     [copy] AppLabsUser.hbm.xml omitted as AppLabsUser.hbm.xml is up to 
date.
     [copy] build.properties omitted as build.properties is up to date.
     [copy] build.xml omitted as build.xml is up to date.
     [copy] hibernate-mapping.xml omitted as hibernate-mapping.xml is up to 
date.
     [copy] hibernate.cfg.xml omitted as hibernate.cfg.xml is up to date.
     [copy] hibernate.properties omitted as hibernate.properties is up to 
date.
     [copy] properties.xml omitted as properties.xml is up to date.

test-resources:
     [echo] Copying Test Resources

compile:
    [javac] org/applabs/hibernate/quickstart/AppLabsUser.java omitted as 
org/applabs/hibernate/quickstart/AppLabsUser.class is up to date.

test-init:
     [copy]  omitted as  is up to date.
     [copy] org omitted as org is up to date.
     [copy] org/applabs omitted as org/applabs is up to date.
     [copy] org/applabs/hibernate omitted as org/applabs/hibernate is up to 
date.
     [copy] org/applabs/hibernate/quickstart omitted as 
org/applabs/hibernate/quickstart is up to date.
   [delete] Deleting directory 
/home/timmy/projects/applabsuser/build/test/data
   [delete] Deleting directory 
/home/timmy/projects/applabsuser/build/test/data
   [delete] Deleting directory 
/home/timmy/projects/applabsuser/build/test/reports
   [delete] Deleting directory 
/home/timmy/projects/applabsuser/build/test/reports
    [mkdir] Created dir: /home/timmy/projects/applabsuser/build/test/data
    [mkdir] Created dir: /home/timmy/projects/applabsuser/build/test/reports

test-compile:
    [javac] org/applabs/hibernate/quickstart/AppLabsUserTest.java omitted as 
org/applabs/hibernate/quickstart/AppLabsUserTest.class is up to date.

test-batch:

build.xml
---------
<?xml version="1.0"?>
<!DOCTYPE project [
    <!ENTITY properties SYSTEM "../applabsuser/properties.xml">
]>

<project name="AppLabsUser"
         default="test-batch" basedir=".">

	<!-- Project settings -->
	<property name="project.name" value="${ant.project.name}"/>
	<property name="project.distname" value="applabs"/>
	<property name="project.version" value="0.3"/>
	<property name="project.version.jar" value="0-3"/>
	<property name="jarfile.name" 
value="${project.distname}-${project.version}.jar"/>
	<property name="jarfile.path" location="${dist.dir}/${jarfile.name}"/>
	<property name="resource.path" 
location="/home/timmy/projects/applabsuser"/>

  <property name="junit.fork" value="true"/>
  &properties;

  <path id="compile.classpath">
    <pathelement path ="lib/hibernate3.jar"/>
    <pathelement path ="lib/commons-lang-1.0.1.jar"/>
    <pathelement path ="lib/commons-logging-1.0.4.jar"/>
  </path>

  <path id="test.classpath">
    <path refid="compile.classpath"/>
    <pathelement location="${junit.jar}"/>
    <pathelement location="${ant-junit.jar}"/>
    <pathelement location="${build.dir}/classes"/>
    <pathelement location="${build.dir}/test"/>
  </path>

  <!-- Public Targets -->
  <target name="clean"
          description="Deletes all files that are generated by the build.">
    <delete dir="${build.dir}"/>
    <delete dir="${dist.dir}"/>
  </target>

    <!-- Copy any resource or configuration files -->
    <target name="resources" depends="init">
    	<echo message="Copying ">Resources</echo>
        <copy todir="classes" includeEmptyDirs="no">
            <fileset dir="${resource.path}/">
            <patternset>
                <include name="*.conf"/>
                <include name="*.properties"/>
                <include name="*.xml"/>
            </patternset>
            </fileset>
        </copy>
    </target>

    <!-- Copy any resource or configuration files -->
    <target name="test-resources" depends="init">
    	<echo message="Copying ">Test Resources</echo>
        <copy todir="classes" includeEmptyDirs="no">
            <fileset dir="${build.dir}/test/">
            <patternset>
                <include name="*.conf"/>
                <include name="*.properties"/>
                <include name="*.xml"/>
            </patternset>
            </fileset>
        </copy>
    </target>

  <!-- Internal Targets -->
  <target name="init">
    <mkdir dir="${build.dir}/classes"/>
    <mkdir dir="${dist.dir}"/>
    <echo message="Building ${ant.project.name}"/>
    <echo message="/////////////////////////////////////////////////////"/>
  </target>

  <!-- Suggested by Stephen McConnell mcconnell@dpml.net
       taskdef suggested by Jan.Materne@rzf.fin-nrw.de
       refuted by Peter Reilly peter.kitt.reilly@gmail.com -->
  <target name="setup-path" depends="init">
    <path id="project.main.path">
      <pathelement location="${ant.jar}"/>
      <pathelement location="${build.dir}/classes"/>
    </path>
    <path id="project.test.path">
      <path refid="project.main.path"/>
      <pathelement location="${ant-junit.jar}"/>
      <pathelement location="${junit.jar}"/>
    </path>
    	<taskdef name="my.junit" classname="${junit.jar}"
		classpathref="project.test.path"/>
  </target>

  <target name="compile" depends="init,resources,test-resources">
    <javac destdir="${build.dir}/classes"
           debug="${build.debug}"
           includeAntRuntime="yes"
           srcdir="src">
      <classpath refid="compile.classpath"/>
    </javac>
  </target>

<!-- Build Javadoc documentation -->
    <target name="javadoc"
     description="Generate JavaDoc API docs">
        <delete dir="./doc/api"/>
        <mkdir dir="./doc/api"/>
        <javadoc sourcepath="./src/"
            destdir="./doc/api"
            classpath="${servlet.jar}:${servlet.jar}"
            packagenames="*"
            author="true"
            private="true"
            version="true"
            windowtitle="${project.name} API Documentation"
            doctitle="&lt;h1&gt;${project.name} Documentation (Version 
${project.version})&lt;/h1&gt;"
            bottom="Copyleft &#169; 2005">
            <classpath refid="compile.classpath"/>
        </javadoc>
    </target>


  <target name="test-init">
    <mkdir dir="${test.dir}"/>

    <copy todir="${test.dir}">
      <fileset dir="test" excludes="**/*.java"/>
    </copy>

    <delete dir="${test.data.dir}"/>
    <delete dir="${test.reports.dir}"/>
    <mkdir dir="${test.data.dir}"/>
    <mkdir dir="${test.reports.dir}"/>
  </target>

  <target name="test-compile" depends="compile,test-init">
    <javac destdir="${test.dir}"
           debug="${build.debug}"
           includeAntRuntime="yes"
           srcdir="test">
      <classpath refid="test.classpath"/>
    </javac>
  </target>

  <target name="test-summary" depends="test-compile">
    <junit printsummary="yes" haltonfailure="true">
      <classpath refid="test.classpath"/>
      <test name="org.catechis.ScoringTest"/>
    </junit>
  </target>

  <target name="test-brief" depends="test-compile">
    <junit printsummary="no" haltonfailure="true">
      <classpath refid="test.classpath"/>
      <formatter type="brief" usefile="false"/>
      <test name="org.catechis.ScoringTest"/>
    </junit>
  </target>

  <target name="test-xml" depends="test-compile">
    <junit printsummary="yes" haltonfailure="true">
      <classpath refid="test.classpath"/>
      <formatter type="brief" usefile="false"/>
      <formatter type="xml"/>
      <test todir="${test.data.dir}"
            name="org.catechis.ScoringTest"/>
    </junit>
  </target>

  <target name="test-batch" depends="test-compile">
    <junit printsummary="withOutAndErr"
    	   haltonfailure="false">
      <classpath refid="test.classpath"/>
      <formatter type="brief" usefile="true"/>
      <formatter type="xml"/>
      <batchtest todir="${test.data.dir}">
        <fileset dir="${test.dir}"
		 includes="**/*Test.class"/>
      </batchtest>
    </junit>
    <junitreport todir="${test.data.dir}">
      <fileset dir="${test.data.dir}">
        <include name="TEST-*.xml"/>
      </fileset>
      <report format="frames" todir="${test.reports.dir}"/>
    </junitreport>
  </target>

  <!--  refid changed from test.classpath to setup-path  -->
  <target name="test" depends="test-compile">
    <junit printsummary="true"
           errorProperty="test.failed"
           failureProperty="test.failed"
           fork="${junit.fork}">
      <classpath>
        <path refid="setup-path"/>
        <pathelement path="${java.class.path}"/>
      </classpath>
      <formatter type="brief" usefile="true"/>
      <formatter type="xml"/>
      <test name="${testcase}" todir="${test.data.dir}" if="testcase"/>
      <batchtest todir="${test.data.dir}" unless="testcase">
        <fileset dir="${test.dir}" includes="**/*Test.class"/>
      </batchtest>
    </junit>

    <junitreport todir="${test.data.dir}">
      <echo message="Generating report?"/>
      <fileset dir="${test.data.dir}">
        <include name="TEST-*.xml"/>
      </fileset>
      <report format="frames" todir="${test.reports.dir}"/>
    </junitreport>

    <fail message="Tests failed. Check log and/or reports." 
if="test.failed"/>
  </target>

  <target name="junit-commandline" depends="test-compile">
    <java classname="junit.textui.TestRunner" classpathref="test.classpath">
      <arg value="org.catechis.ScoringTest"/>
    </java>
  </target>

	<target name="dist" depends="compile"
		description="make the jar file">
		<jar destfile="${dist.dir}/catechis${project.version.jar}.jar" 
compress="true">
			<fileset dir="${build.dir}/classes"/>
		</jar>
	</target>


</project>


protperties.xml
---------------
<!--:mode=ant -->
  <!-- ========================================================== -->
  <!-- ugly things -->
  <!-- ========================================================== -->

  <!-- ========================================================== -->
  <!-- Load Environment Variables                                 -->
  <!-- ========================================================== -->
  <!-- #Load environment variables -->
  <property environment="env"/>

  <!-- this is here to deal with the fact that an IntelliJ IDEA build has no 
ant home -->
  <property name="ant.home" value="${env.ANT_HOME}" />
  <property name="junit.home" value="${env.JUNIT_HOME}" />

  <!-- get Unix hostname, and set to Windows comparable name -->
  <!-- #Trick to get host name x-platform -->
  <property name="env.COMPUTERNAME" value="${env.HOSTNAME}"/>

  <!-- ========================================================== -->
  <!-- Load property files                                        -->
  <!--   Note: the ordering is VERY important.                    -->
  <!-- ========================================================== -->
  <!-- #Allow even users property file to relocate -->
  <property name="user.properties.file"
            location="/home/timmy/projects/applabsuser/build.properties"/>

  <!-- Load the application specific settings -->
  <!-- #Project specific props -->
  <!-- property file="build.properties"/ -->

  <!-- Load user specific settings -->
  <!-- #User specific properties (username/password, etc) -->
  <!-- property file="${user.properties.file}"/ -->

  <!-- ========================================================== -->
  <!-- Directory mappings                                         -->
  <!-- ========================================================== -->
  <!-- #Note use of 'location' -->
  <property name="root.dir" location="${basedir}"/>
  <property name="masterbuild.dir" location="${root.dir}/.."/>
  <property file="${masterbuild.dir}/build.properties"/>

  <property name="src.dir" location="${root.dir}/src"/>

  <property name="build.dir" location="build"/>
  <property name="build.classes.dir"
    location="${build.dir}/classes"/>
  <property name="dist.dir" location="dist"/>
  <property name="dist.bin.dir" location="${dist.dir}/bin"/>
  <property name="doc.dir" location="doc"/>
  <property name="javadoc.dir" location="${doc.dir}/javadoc"/>
  <property name="lib.dir" location="${masterbuild.dir}/lib"/>


  <!-- ========================================================== -->
  <!-- Compile settings                                           -->
  <!-- ========================================================== -->
  <!-- #Typical defaults for javac -->
  <property name="build.debug" value="on"/>
  <property name="build.optimize" value="off"/>

  <!-- ========================================================== -->
  <!-- Test settings                                              -->
  <!-- ========================================================== -->
  <property name="test.dir" location="${build.dir}/test"/>
  <property name="test.classes.dir" location="${test.dir}/classes"/>
  <property name="test.data.dir" location="${test.dir}/data"/>
  <property name="test.reports.dir" location="${test.dir}/reports"/>
  <property name="test.src.dir" location="${root.dir}/test"/>
  <property name="test.last.failed.file"
    location="${build.dir}/.lasttestsfailed"/>


  <!-- ========================================================== -->
  <!-- Library dependency settings                                -->
  <!-- ========================================================== -->
  <!-- #Library indirection -->
  <property name="lib.properties.file"
    location="${lib.dir}/lib.properties"/>

  <!-- #lib.properties.file contains .version props -->
  <property file="${lib.properties.file}"/>

  <!-- library directory mappings -->
  <!-- #directory mappings to each librarys root -->
  <!-- #actual distribution directory structure underneath -->
  <property name="checkstyle.dir"
    location="${lib.dir}/checkstyle-${checkstyle.version}"/>

  <property name="junit.dir"   location="${junit.home}"/>


  <!-- each library has its own unique directory structure -->
  <!-- #each librarys own directory structure (note using 'value') -->
  <property name="checkstyle.subdir" value=""/>
  <property name="hsqldb.subdir"     value=""/>
  <property name="j2ee.subdir"       value="lib"/>
  <property name="jtidy.subdir"      value="build"/>
  <property name="junit.subdir"      value=""/>
  <property name="log4j.subdir"      value="dist/lib"/>
  <property name="lucene.subdir"     value=""/>
  <property name="struts.subdir"     value="lib"/>
  <property name="torque.subdir"     value="lib"/>
  <property name="xdoclet.subdir"    value="lib"/>
  <property name="httpunit.subdir"    value="lib"/>
  <property name="axis.subdir"    value="lib"/>
  <property name="webtest.subdir" value="lib"/>
  <property name="xercesxalan.subdir"    value="lib"/>

  <!-- JAR file mappings -->
  <!-- #mappings directly to jar files -->
  <property name="checkstyle.jar"
    
location="${checkstyle.dir}/${checkstyle.subdir}/checkstyle-all-${checkstyle.version}.jar"/>

  <property name="junit.jar"
    location="${junit.dir}/junit.jar"/>

  <property name="ant-junit.jar"
    location="${ant.home}/lib/ant-junit.jar"/>

  <!-- ========================================================== -->
  <!-- xml logger config -->
  <!-- ========================================================== -->

<!--
    <property name="log.dir"
        location="${env.CATALINA_HOME}/webapps/ROOT/log"/>
-->
    <property name="log.dir"
        location="${masterbuild.dir}/log"/>

<!--   <property name="ant.XmlLogger.stylesheet.uri"
      location="${ant.home}/etc/log.xsl" />  -->


  <!-- ========================================================== -->
  <!-- index info -->
  <!-- ========================================================== -->
  <property name="index.dir"
    location="${masterbuild.dir}/index/build/index"/>

  <property name="docstoindex.dir" value="${ant.home}/docs"/>
  <fileset dir="${docstoindex.dir}" id="indexed.files"/>

  <!-- ========================================================== -->
  <!-- generated output -->
  <!-- name the files we are creating-->
  <!-- ========================================================== -->
  <property name="antbook-ant.dist.dir"
    location="${masterbuild.dir}/ant/dist/"/>

  <property name="antbook-ant.jar"
    location="${antbook-ant.dist.dir}/antbook-ant.jar"/>

  <property name="antbook-common.dist.dir"
    location="${masterbuild.dir}/common/dist/"/>

  <property name="antbook-common.jar"
    location="${antbook-common.dist.dir}/antbook-common.jar"/>



build.properties
----------------
lib.dir=/home/timmy/projects/dist



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message