ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marshall_Dan...@emc.com
Subject RE: Ant Junit issues
Date Thu, 18 Dec 2008 15:01:36 GMT
Sure I can give you some of it. It looks like its dropping my source
paths but I don't know why.

Here is the xml:

<!--Ant build file for EMCLmcryptKeyGenerator-->
<project name="EMCLmcryptKeyGenerator" basedir="C:/Build"
default="clean-compile-Lmcrypt">

	<property file="C:/Build/build.properties"/>
	
	<!--=========================Clean
Target========================-->
    <target name="clean-Lmcrypt">
        <delete dir="${build.dir}"/>
		<mkdir dir="${build.dir}"/>
    </target>
	

	<!--=========================Compile
Target========================-->
    <target name="compile-Lmcrypt" depends="clean-Lmcrypt">
        <mkdir dir="${classes.dir}"/>
        <javac source="1.5" target="1.5" nowarn="true"
srcdir="${src.dir}" destdir="${classes.dir}" debug="true"
deprecation="false">				
		<classpath>			
			<fileset dir="${latest.dir}">
				<include name="**/*.jar"/>
			</fileset>
		</classpath>
		</javac>
		<!--=========================Copy
Resources========================-->
		<copy todir="${classes.dir}">
			<fileset dir="${src.dir}" excludes="**/*.java"/>
		</copy>	
    </target>
	
	
	<!--=========================Run JUnit
Target========================-->	
	<target name="run-JUnit-Lmcrypt" description="Run JUnit tests
for EMCLmcryptKeyGenerator.java" depends="compile-Lmcrypt">
		<mkdir dir="${reports}"/>
		<junit printsummary="yes" haltonerror="yes"
haltonfailure="yes" fork="yes">
			<formatter type="plain" usefile="false"/>
			<test
name="com.emc.elms.test.EMCLmcryptKeyGeneratorTest"/>
			<classpath>
				<pathelement
location="${lmcrypt.src.dir}"/>
				<pathelement
location="${lmcrypt.test.src.dir}"/>
				<pathelement
location="${lmcrypt.class.dir}"/>
				<pathelement
location="${lmcrypt.test.class.dir}"/>
			</classpath>
		</junit>
	</target>
	
	<target name="clean-compile-Lmcrypt"
depends="clean-Lmcrypt,compile-Lmcrypt,run-JUnit-Lmcrypt"/>
	
</project>

Here is the properties file:
#This is the property file for build.xml. 
latest.dir=C:/Build/LatestVersion
src.dir=${latest.dir}/src
lib.dir=${latest.dir}/lib
build.dir=C:/Build/build
classes.dir=${build.dir}/classes
reports=${build.dir}/reports

#lmcrypt
lmcrypt.test.src.dir=C:/Build/LatestVersion/src/com/emc/elms/test
lmcrypt.src.dir=C:/Build/LatestVersion/src/com/emc/elms/keygen
lmcrypt.test.class.dir=C:/Build/build/src/com/emc/elms/test
lmcrypt.class.dir=C:/Build/build/src/com/emc/elms/keygen

Here is the output:

run-JUnit-Lmcrypt:
    [mkdir] Created dir: C:\Build\build\reports
    [junit] Found C:\Ant\lib\junit.jar
    [junit] Found C:\Ant\lib\ant-launcher.jar
    [junit] Found C:\Ant\lib\ant.jar
    [junit] Found C:\Ant\lib\ant-junit.jar
    [junit] Implicitly adding
C:\Ant\lib\junit.jar;C:\Ant\lib\ant-launcher.jar;C:\Ant\lib\ant.jar;C:\A
nt\lib\ant-junit.jar to CLASSPATH
dropping C:\Build\build\src\com\emc\elms\keygen from path as it doesn't
exist
dropping C:\Build\build\src\com\emc\elms\test from path as it doesn't
exist
dropping C:\Build\build\src\com\emc\elms\keygen from path as it doesn't
exist
dropping C:\Build\build\src\com\emc\elms\test from path as it doesn't
exist
dropping C:\Build\build\src\com\emc\elms\keygen from path as it doesn't
exist
dropping C:\Build\build\src\com\emc\elms\test from path as it doesn't
exist
dropping C:\Build\build\src\com\emc\elms\keygen from path as it doesn't
exist
dropping C:\Build\build\src\com\emc\elms\test from path as it doesn't
exist
    [junit] Executing 'C:\Program
Files\Java\jdk1.5.0_16\jre\bin\java.exe' with arguments:
    [junit] '-classpath'
    [junit]
'C:\Build\LatestVersion\src\com\emc\elms\keygen;C:\Build\LatestVersion\s
rc\com\emc\elms\test;C:\Ant\lib\junit.jar;C:\Ant\lib\ant-launcher.jar;C:
\Ant\lib\ant.jar;C:\Ant\lib\ant-junit.jar'
    [junit]
'org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner'
    [junit] 'com.emc.elms.test.EMCLmcryptKeyGeneratorTest'
    [junit] 'filtertrace=true'
    [junit] 'haltOnError=true'
    [junit] 'haltOnFailure=true'
    [junit]
'formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResu
ltFormatter'
    [junit] 'showoutput=false'
    [junit] 'outputtoformatters=true'
    [junit] 'logtestlistenerevents=true'
    [junit]
'formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResult
Formatter'
    [junit] 'crashfile=C:\Build\junitvmwatcher257818702.properties'
    [junit] 'propsfile=C:\Build\junit1503989364.properties'
    [junit] 
    [junit] The ' characters around the executable and arguments are
    [junit] not part of the command.
Execute:Java13CommandLauncher: Executing 'C:\Program
Files\Java\jdk1.5.0_16\jre\bin\java.exe' with arguments:
'-classpath'
'C:\Build\LatestVersion\src\com\emc\elms\keygen;C:\Build\LatestVersion\s
rc\com\emc\elms\test;C:\Ant\lib\junit.jar;C:\Ant\lib\ant-launcher.jar;C:
\Ant\lib\ant.jar;C:\Ant\lib\ant-junit.jar'
'org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner'
'com.emc.elms.test.EMCLmcryptKeyGeneratorTest'
'filtertrace=true'
'haltOnError=true'
'haltOnFailure=true'
'formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResu
ltFormatter'
'showoutput=false'
'outputtoformatters=true'
'logtestlistenerevents=true'
'formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResult
Formatter'
'crashfile=C:\Build\junitvmwatcher257818702.properties'
'propsfile=C:\Build\junit1503989364.properties'

The ' characters around the executable and arguments are
not part of the command.
    [junit] Running com.emc.elms.test.EMCLmcryptKeyGeneratorTest
    [junit] Testsuite: com.emc.elms.test.EMCLmcryptKeyGeneratorTest
    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
    [junit] 
    [junit] 	Caused an ERROR
    [junit] com.emc.elms.test.EMCLmcryptKeyGeneratorTest
    [junit] java.lang.ClassNotFoundException:
com.emc.elms.test.EMCLmcryptKeyGeneratorTest
    [junit] 	at
java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    [junit] 	at java.security.AccessController.doPrivileged(Native
Method)
    [junit] 	at
java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    [junit] 	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    [junit] 	at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
    [junit] 	at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    [junit] 	at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    [junit] 	at java.lang.Class.forName0(Native Method)
    [junit] 	at java.lang.Class.forName(Class.java:164)
    [junit]  

-----Original Message-----
From: Mark Salter [mailto:marksalter@talktalk.net] 
Sent: Thursday, December 18, 2008 9:54 AM
To: Ant Users List
Subject: Re: Ant Junit issues

Marshall_Daniel@emc.com wrote:
> I am fairly new to Ant and I am having issues with an ant script that
I
> am working on. I am receiving a ClassNotFoundException when the Junit
> portion of my Ant script runs.
Is the missing class one of yours?

> The build and everything before that is
> working correctly and the correct .class file is included in the class
> path for the Junit portion.
CLASSPATHs don't hold class files directly, instead a list of locations
in which class files may be found...

> Is it possible to include a .class file to
> the Junit classpath instead of a .jar? 
Can you show us your junit task xml and perhaps the full stacktrace you
got?

-- 
Mark

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



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


Mime
View raw message