Hi Nicolas In maven 1.X there's 2 classloaders The root classloader where is ant and the root.maven classloader where is maven and its dependencies.
If you use an ant task which need a dependency you must add the in the root classloader to allow ant to find it. In your POM these dependencies must have : <properties> <classloader>root</classloader> </properties> Also, you can take a look at this issue : http://jira.codehaus.org/browse/MAVEN-1712 Arnaud On 10/14/05, Nicolas De Loof <[EMAIL PROTECTED]> wrote: > > > I've found the cause of the problem : > I've reduced my ant task to this code : > > execute() { > log("getContextClassLoader() = " + > Thread.currentThread().getContextClassLoader()); > } > > When I run it with ANT (1.5.3.1 <http://1.5.3.1>) I get > [test] Thread.currentThread().getContextClassLoader() = > [EMAIL PROTECTED] > > So It may be the same from a maven.xml script ! > > When I run "maven ndl:test" (maven 1.0.2) I get > > ndl:test: > [test] Thread.currentThread().getContextClassLoader() = *null* > BUILD SUCCESSFUL > > Is there any reason for this, a workaround or anything to do ? > > Nico. > > Nicolas De Loof a écrit : > > > > > Hello, > > > > I'm using maven 1.0.2 and try to create a plugin for an ant task, that > > itself uses Springframework. > > > > As I get strange troubles, I've dropped all specific code to get only > > an ant task that creates a spring context. > > The spring context is reduced to a single bean of type String. > > > > When I run it as an ant task, it works fine, ie. the Spring context is > > loaded : > > >ant > > Buildfile: build.xml > > test: > > Trying to override old definition of task test > > [test] TEST !!!! > > [test] 13 oct. 2005 17:33:06 > > org.springframework.beans.factory.xml.XmlBeanDefinitionReader > > loadBeanDefinitions > > [test] INFO: Loading XML bean definitions from file > > [D:\workspace\ant-maven-failure\Designer-context.xml] > > ... > > > > When I run it from a maven.xml goal (ndl:test) it fails with a strange > > error : > > > > >maven -e ndl:test > > __ __ > > | \/ |__ _Apache__ ___ > > | |\/| / _` \ V / -_) ' \ ~ intelligent projects ~ > > |_| |_\__,_|\_/\___|_||_| v. 1.0.2 > > build:start: > > ndl:init: > > [taskdef] Trying to override old definition of task test > > ndl:test: > > [test] TEST !!!! > > BUILD FAILED > > org.springframework.beans.factory.BeanCreationException: Error > > creating bean with name 'reverse' defined in file > > [D:\workspace\ant-maven-failure\Designer-context.xml]: Instantiation > > of bean failed; nested exception is java.lang.IllegalStateException: > > Bean definition does not carry a resolved bean class > > java.lang.IllegalStateException: Bean definition does not carry a > > resolved bean class > > at > > > org.springframework.beans.factory.support.AbstractBeanDefinition.getBeanClass > (AbstractBeanDefinition.java:205) > > > > > > > > Does anybody have any suggestion to investigate and solve this ? > > > > You can download the project from > > http://loof.free.fr/ant-maven-failure.zip (3Mo) > > run "ant" and compare with "maven ndl:test" > > > > Nico. > > > > This message contains information that may be privileged or > > confidential and is the property of the Capgemini Group. It is > > intended only for the person to whom it is addressed. If you are not > > the intended recipient, you are not authorized to read, print, > > retain, copy, disseminate, distribute, or use this message or any > > part thereof. If you receive this message in error, please notify the > > sender immediately and delete all copies of this message. > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > This message contains information that may be privileged or confidential > and is the property of the Capgemini Group. It is intended only for the > person to whom it is addressed. If you are not the intended recipient, you > are not authorized to read, print, retain, copy, disseminate, distribute, or > use this message or any part thereof. If you receive this message in error, > please notify the sender immediately and delete all copies of this message. > >
