I thank you for responding, however, I can able to successfully use
spring from within ant (using the java and junit tasks). My java and
junit tasks (which work) have the exact same classpath as my taskdef.
It seems that by having it in a taskdef does not allow for classpath
resources that are directories. My other resources (spring jars, custom
pojo's) appear to be visible to the ant task. Just not directories in
which resources are kept.
Kev Jackson wrote:
My taskdef is as follows:
<taskdef name="authsum"
classname="org.authsum.configuration.ant.taskdefs.AuthSumProperty">
<classpath>
<path refid="springframework.classpath"/>
<fileset file="../dbom/build/dbom.jar"/>
<fileset file="../services/build/services.jar"/>
<!-- the configContext.xml file is in
../services/src/conf -->
<dirset dir="../services/src/conf"/>
<!-- the following is to pick the log4j props -->
<dirset dir="../src/conf"/>
<fileset file="../anttask/build/anttask.jar"/>
</classpath>
</taskdef> BUILD FAILED
/home/rhodepc/configuration/tests/build.xml:97:
org.springframework.beans.factory.BeanDefinitionStoreException:
IOException parsing XML document from class path resource
[configContext.xml]; nested exception is
java.io.FileNotFoundException: class path resource
[configContext.xml] cannot be opened because it does not exist
This is really more of a spring config issue than an ant issue from
what I can see from the stack trace. I remember Spring being quite
awkward with respect to loading xml files from classpath, can you
build a basic unit test like so:
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContext;
import
org.springframework.context.support.ClassPathXmlApplicationContext;
import junit.framework.TestCase;
public class BaseDAOTestCase extends TestCase {
protected final Log log = LogFactory.getLog(getClass());
protected final static ApplicationContext CTX;
static {
String[] paths = {"applicationContext.xml"};
CTX = new ClassPathXmlApplicationContext(paths);
}
public void testClasspath() {
assert(true);
}
}
basically this will remove ant completely from the equation and allow
you to focus on why Spring cannot resolve the config file.
I have had problems in the past trying to run stuff like this from
within eclipse (as it has it's own ideas of classpath), so make sure
you do this from command line and make sure that CLASSPATH variable is
not set first, hope this helps
Kev
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]