Peter,
as already stated my previous reply, you should not specify the
dependencies at the plugin level but at the pom level.
The dependencyManagement will then take care of overriding the version.
Cheers
On 28/03/2011 16:23, Peter Suggitt wrote:
> Sorry, wrong version of the log file - correct one attached:
> - apologies for 3G users for last email ... forgot to zip it up
>
> See line 1475 where there is a 2.5.6 runtime dependency different to
> all other dependencies from the build log.
>
>
>
> On Mon, 2011-03-28 at 15:10 +0100, Peter Suggitt wrote:
>> Hi Mauro
>>
>> In the example I sent through on friday I am using the
>> SpringAnnotatedEmbedderRunner in the main story class. In this I am
>> bringing in the spring resources for the configuration and steps,
>> that in turn load up my application beans. The spring cfg file that
>> i am using in my application uses the spring 3.0 xsd (resolved
>> through the spring-context-3.0.5.RELEASE.jar). Now when this is
>> loaded through the SpringAnnotatedEmbedderRunner the schema cannot be
>> resolved and indeed the beans loader debug suggests that there are no
>> 3.0 schemas to resolve:
>>
>>> 11-03-28T15:04:53.799 | main | PluggableSchemaResolver | DEBUG
>>> - Loading schema mappings from [META-INF/spring.schemas]
>>> 11-03-28T15:04:53.802 | main | PluggableSchemaResolver | DEBUG
>>> - Loaded schema mappings:
>>> {http://www.springframework.org/schema/util/spring-util.xsd=org/springframework/beans/factory/xml/spring-util-2.5.xsd,
>>>
>>> http://www.springframework.org/schema/util/spring-util-2.0.xsd=org/springframework/beans/factory/xml/spring-util-2.0.xsd,
>>>
>>> http://www.springframework.org/schema/beans/spring-beans.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd,
>>>
>>> http://www.springframework.org/schema/jee/spring-jee.xsd=org/springframework/ejb/config/spring-jee-2.5.xsd,
>>>
>>> http://www.springframework.org/schema/tool/spring-tool-2.5.xsd=org/springframework/beans/factory/xml/spring-tool-2.5.xsd,
>>>
>>> http://www.springframework.org/schema/jee/spring-jee-2.5.xsd=org/springframework/ejb/config/spring-jee-2.5.xsd,
>>>
>>> http://www.springframework.org/schema/lang/spring-lang-2.0.xsd=org/springframework/scripting/config/spring-lang-2.0.xsd,
>>>
>>> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd,
>>>
>>> http://www.springframework.org/schema/tool/spring-tool.xsd=org/springframework/beans/factory/xml/spring-tool-2.5.xsd,
>>>
>>> http://www.springframework.org/schema/lang/spring-lang.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd,
>>>
>>> http://www.springframework.org/schema/context/spring-context-2.5.xsd=org/springframework/context/config/spring-context-2.5.xsd,
>>>
>>> http://www.springframework.org/schema/util/spring-util-2.5.xsd=org/springframework/beans/factory/xml/spring-util-2.5.xsd,
>>>
>>> http://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-2.5.xsd,
>>>
>>> http://www.springframework.org/schema/tool/spring-tool-2.0.xsd=org/springframework/beans/factory/xml/spring-tool-2.0.xsd,
>>>
>>> http://www.springframework.org/schema/jee/spring-jee-2.0.xsd=org/springframework/ejb/config/spring-jee-2.0.xsd,
>>>
>>> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans-2.0.xsd,
>>>
>>> http://www.springframework.org/schema/lang/spring-lang-2.5.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd}
>>>
>>
>> To your point, it is worth mentioning that when I have web-access on
>> the tests etc run absolutely fine as they can resolve the xsd to the
>> central location, when I have no internet access on the machine it
>> will fail. So a work around would be to configure my beans defs to
>> use the 2.5 xsd and this then works fine. This still means that when
>> the runner runs, it is doing do with a 2.5.6 jar and thus under the
>> current state it will not ever be able to resolve 3.0 schemas unless
>> it has access to the internet at test time.
>>
>> As you describe, I can see in the dependency tree that 3.0.5 is
>> taking precendence over the 2.5.6 lib, yet in the attached build log
>> (line 1475) we can see that the 2.5.6 library is being used.
>>
>> Story class annotations:
>>> @RunWith(SpringAnnotatedEmbedderRunner.class)
>>> @Configure(storyLoader = LoadFromURL.class)
>>> @UsingEmbedder(embedder = Embedder.class)
>>> @UsingSpring(resources = { "classpath:xml/jbehave-configuration.xml",
>>> "classpath:xml/state-machine-steps.xml" })
>>> public class TraverseStateMachine extends InjectableEmbedder {
>>
>> I agree that overriding the dependencies in the maven plugin is not
>> the right way forward and was done as an exercise to check whether
>> this allows the 3.0 xsd to be resolved, which it does.
>>
>> I can see in your examples that you are using the 2.5 xsd in your
>> configuration.xml, if this were to use the 3.0 xsd I believe you will
>> see the same issues as I am describing above.
>>
>> So I think that there really is actually an issue here that simple
>> dependency management does not resolve. Does that make sense?
>>
>>
>> On Sat, 2011-03-26 at 11:36 +0100, Mauro Talevi wrote:
>>> Peter,
>>>
>>> the jbehave-maven-plugin is not coupled with jbehave-spring.
>>>
>>> If you want to use Spring 3.0.5 instead of 2.5.6, all you need to do is
>>> use dependency management to override the transitive dependency.
>>>
>>> I've modified the trader-spring example pom.xml to show this in action.
>>>
>>> https://github.com/jbehave/jbehave-core/blob/master/examples/trader-spring/pom.xml
>>>
>>> If you run:
>>>
>>> mvn dependency:tree -Dspring.version=3.0.5.RELEASE
>>>
>>> you'll see that the 2.5.6 version is overridden with 3.0.5.
>>>
>>> Note that you should not configure your dependencies at the plugin
>>> level, rather at the POM level.
>>>
>>> The spring trader example runs fine with both Spring 2.5.x and 3.0.x -
>>> as well as mvn 2.2.1 and mvn 3.0.2.
>>>
>>> Cheers
>>>
>>> On 25/03/2011 21:43, Peter Suggitt wrote:
>>> > From: Peter Suggitt <[email protected]
>>> > <mailto:[email protected]>>
>>> > Reply-to: [email protected] <mailto:[email protected]>
>>> > To: [email protected] <mailto:[email protected]>
>>> > Subject: Spring 3.0.5 & Maven 3.0 integration - uses spring 2.5.6
>>> > transitively
>>> > Date: Fri, 25 Mar 2011 20:40:02 +0000
>>> >
>>> >
>>> > Hi Mauro et al
>>> >
>>> > Firstly, I am a big fan of what you guys are doing and what you have
>>> > produced here.
>>> >
>>> > I have a small problem though. I am using JBehave 3.2 with the maven
>>> > plugin to test a library that uses Spring 3.0.5. My application POM
>>> > defines Spring 3.0.5 libraries as dependencies, yet when I run JBehave I
>>> > am finding that the jbehave-spring library is bringing in a transitive
>>> > Spring 2.5.6 dependency. This manifests itself in my JBehave runtime
>>> > now having spring 2.5.6 in its classloader rather than the hoped for
>>> > spring 3.0.5 dependency.
>>> >
>>> > When I set the jbehave-maven-plugin to depend on spring 3.0.5
>>> > (overriding the jbehave-spring pom) I get an issue with the a Format
>>> > class (now Abstract in spring 3).
>>> >
>>> > Key thing for me in this is that the jbehave-spring library coupled with
>>> > the jbehave-maven-plugin means that the runtime tests are being run with
>>> > spring 2.5.6. Clearly this is not desired behaviour given that this
>>> > implies using a jbehave defined spring version rather than the one from
>>> > my POM.
>>> >
>>> > Happy to share code/poms etc with you to help find an answer.
>>> >
>>> > Would love to hear your thoughts/advice on this one.
>>> >
>>> >
>>> > Kind regards
>>> > Pete Suggitt
>>> >
>>> >
>>> > ---------------------------------------------------------------------
>>> > To unsubscribe from this list, please visit:
>>> >
>>> > http://xircles.codehaus.org/manage_email
>>> >
>>> >
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>> http://xircles.codehaus.org/manage_email
>>>
>>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email