[hibernate-dev] Another pull request for supporting Infinispan 7.2.1 in 4.3

Steve Ebersole steve at hibernate.org
Wed May 13 22:03:19 EDT 2015


Well you have to realize that there are 3 classpaths involved here:
1) compiling the main sources (compile)
2) compiling the test sources (testCompile)
3) running the tests (testRuntime)

You can set each of those differently.  But instead what you do is to
change all 3 to the same value.  Obviously if you ask Gradle to compile
with a different Infinispan version by specifying it in compile
Configuration it is going to recognize that and recompile the main
sources.  That's a GoodThing(tm).  But really you are doing the wrong
thing.  Really you just want to keep the same Infinispan version
(6.whatever) for compile and testCompile.  You really just want variance in
testRuntime.

The one concern with this is that Gradle willl then see a "version
conflict".  It will see Infinispan 6 in the compile and testCompile (via
compile) configurations, and Infinispan 7 in the testRuntime
configuration.  I am not exactly sure what Gradle will do there.  But I do
know that you can tell Gradle what to do there... by forcing the version.
In fact ResolutionStrategy is all about these "version conflicts" and what
to do.

So something like this in hibernate-infinispan.gradle:

if ( useInfinispan7ForTesting() ) {
    configurations {
        testRuntime {
            resolutionStrategy {
                force 'org.infinispan:infinispan-core:7.2.1.Final`
            }
        }
    }
}

dependencies {
    compile( libraries.infinispan ) // 6, as before
    ...
}

I actually think you can use force to force the version to use even if it
is not a case of a version conflict.  That's what the above tries.  In
testRuntime there really is not version conflict
for 'org.infinispan:infinispan-core', but we ask Gradle to force
the 'org.infinispan:infinispan-core' version to 7.2.1.Final.  That is my
reading of how forced versions work based on the DSL guide.  I have not
tried it myself, so I do not know how it works in practice.


On Wed, May 13, 2015 at 7:43 PM, Gail Badner <gbadner at redhat.com> wrote:

> I don't think I fully understand Gradle ResolutionStrategy. [1]
>
> I'm looking for something that could be used to change test runtime
> dependencies, without rebuilding the hibernate-infinspan jar. I'm not
> proficient enough with Gradle to know if ResolutionStrategy can be used for
> that, I'll have to look into it after 4.3.10.Final is released.
>
> I did some experimenting though and found that by making the following
> change in libraries.gradle, I can test with a different version of
> Infinispan:
>
> -    infinispanVersion = '6.0.0.Final'
> +    infinispanVersion =  project.hasProperty( 'infinispanVersion' ) ?
> infinispanVersion : '6.0.0.Final'
>
> I can force Hibernate to test using Infinispan 7.2.1.Final with the 7.2
> test configuration using the command:
> ../gradlew test -PinfinispanVersion=7.2.1.Final
> -Dhibernate.cache.infinispan.cfg=src/test/resources/infinispan-7-configs.xml
>
> Unfortunately, it forces source/test code to be rebuilt using Infinispan
> 7.2.1.Final. I would really like to be able to test using the
> hibernate-infinispan jar built using Infinispan 6.0.0.Final as a build
> dependency, because WildFly will be using the Hibernate 4.3.10.Final jar
> built with Infinispan 6.0.0.Final.
>
> I'm going to move forward with releasing 4.3.10.Final and revisit this
> later.
>
> Thanks everyone for your help on getting 4.3 to work with Infinispan
> 7.2.1.Final. It is very much appreciated.
>
> Gail
>
> [1]
> http://gradle.org/docs/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html
>
> ----- Original Message -----
> > From: "Scott Marlow" <smarlow at redhat.com>
> > To: "Gail Badner" <gbadner at redhat.com>, "Steve Ebersole" <
> steve at hibernate.org>
> > Cc: "Sanne Grinovero" <sanne at hibernate.org>, "Galder Zamarreño" <
> galder at redhat.com>, "Hibernate Dev"
> > <hibernate-dev at lists.jboss.org>
> > Sent: Wednesday, May 13, 2015 11:56:04 AM
> > Subject: Re: Another pull request for supporting Infinispan 7.2.1 in 4.3
> >
> >
> > On 05/13/2015 02:48 PM, Gail Badner wrote:
> > > As suggested by Sanne and Galder, I'll open a new Jira for the commit
> in my
> > > pull request and amend the comment to reflect the new Jira.
> > >
> > > I'll see if I can get "forced version" in Gradle working in the next
> couple
> > > of hours. If not, I don't want to hold up releasing 4.3.10.Final for
> this.
> > > I can try to get those details worked out later.
> > >
> > > I think that about wraps up what is needed for Hibernate 4.3 to
> support and
> > > test with Infinispan 7.2.1.Final.  Unless I hear otherwise, I plan to
> > > release 4.3.10.Final later today, tomorrow at the latest.
> >
> > Awesome, thanks for all of the help Gail in syncing Hibernate up to
> > Infinispan 7.2.1!  Thanks to Sanne, Galder & Steve as well.  Very much
> > appreciated!
> >
> > I'm not sure of what will be in Infinispan 8.0 but that could need more
> > hibernate-infinispan changes as well.  I think that Infinispan 8.0 might
> > find its way into WildFly 10.
> >
> > >
> > > Regards,
> > > Gail
> > >
> > > ----- Original Message -----
> > >> From: "Steve Ebersole" <steve at hibernate.org>
> > >> To: "Gail Badner" <gbadner at redhat.com>
> > >> Cc: "Sanne Grinovero" <sanne at hibernate.org>, "Scott Marlow"
> > >> <smarlow at redhat.com>, "Galder Zamarreño"
> > >> <galder at redhat.com>, "Hibernate Dev" <hibernate-dev at lists.jboss.org>
> > >> Sent: Wednesday, May 13, 2015 9:57:24 AM
> > >> Subject: Re: Another pull request for supporting Infinispan 7.2.1 in
> 4.3
> > >>
> > >> Not sure what limitations you mean.  All I said was that if you
> wanted to
> > >> allow testing with both you would need to make this conditional and
> expose
> > >> a property to control which to use.
> > >>
> > >> On Wed, May 13, 2015 at 11:29 AM, Gail Badner <gbadner at redhat.com>
> wrote:
> > >>
> > >>> Adding hibernate-dev.
> > >>>
> > >>> No, I did not have a chance to read up on what you suggested. I
> sounded
> > >>> like it had some limitations that would not work, but maybe I
> > >>> misunderstood. I'll look into it today.
> > >>>
> > >>> The last couple of days have been very long. Sorry for the
> oversights.
> > >>>
> > >>> ----- Original Message -----
> > >>>> From: "Steve Ebersole" <steve at hibernate.org>
> > >>>> To: "Gail Badner" <gbadner at redhat.com>
> > >>>> Cc: "Sanne Grinovero" <sanne at hibernate.org>, "Scott Marlow" <
> > >>> smarlow at redhat.com>, "Galder Zamarreño"
> > >>>> <galder at redhat.com>
> > >>>> Sent: Wednesday, May 13, 2015 5:33:24 AM
> > >>>> Subject: Re: Another pull request for supporting Infinispan 7.2.1
> in 4.3
> > >>>>
> > >>>> On May 13, 2015 7:32 AM, "Steve Ebersole" <steve at hibernate.org>
> wrote:
> > >>>>>
> > >>>>> 1) This really should be a hibernate-core discussion
> > >>>>
> > >>>> I meant to say hibernate-dev...
> > >>>>
> > >>>>> 2) I already suggested using forced version in Gradle and gave you
> a
> > >>> link
> > >>>> on how that works.  Did you read it?  Did you try it?
> > >>>>>
> > >>>>> On May 13, 2015 2:04 AM, "Gail Badner" <gbadner at redhat.com> wrote:
> > >>>>>>
> > >>>>>> Sanne, Scott, and I discussed how Hibernate should deal with
> > >>> supporting
> > >>>> Infinispan 7.2.1 in 4.3 earlier today. I think the consensus was it
> > >>>> would
> > >>>> be sufficient to:
> > >>>>>> - specify the Infinispan 7.2 configuration by using
> > >>>> hibernate.cache.infinispan.cfg (so Hibernate wouldn't have to
> switch if
> > >>>> parsing failed);
> > >>>>>> - run tests manually with Infinispan 7.2 for WildFly integration
> > >>> testing.
> > >>>>>>
> > >>>>>> I created another pull request:
> > >>>> https://github.com/hibernate/hibernate-orm/pull/953
> > >>>>>>
> > >>>>>> My pull request incorporated some of Galder's changes from
> > >>>> https://github.com/hibernate/hibernate-orm/pull/951.
> > >>>>>>
> > >>>>>> The main differences:
> > >>>>>> - Hibernate will consider the 7.2 configuration as test code
> > >>>>>> - the 7.2 configuration can be specified using
> > >>>>
> > >>>
> -Dhibernate.cache.infinispan.cfg=src/test/resources/infinispan-7-configs.xml
> > >>>>>>
> > >>>>>> Currently, the only way to run hibernate-infinispan tests is to
> change
> > >>>> infinispanVersion from 6.0.0.Final to 7.2.1.Final. It would be nice
> to
> > >>>> be
> > >>>> able to specify infinispanVersion as a environment variable,
> defaulting
> > >>> to
> > >>>> 6.0.0.Final to avoid having to manually update libraries.gradle.
> > >>>>>>
> > >>>>>> Another consideration is that manually updating libraries.gradle
> > >>> forces
> > >>>> a re-build using Infinispan 7.2.1 as a dependency.
> > >>>>>>
> > >>>>>> Since WildFly will use a hiberanate-infinispan jar build against
> > >>>> Infinispan 6.0.0.Final (won't it???), I think it would be best if we
> > >>> could
> > >>>> run unit tests without rebuilding with Infinispan 7.2.1, but using
> it as
> > >>> a
> > >>>> run time dependency. I haven't been able to figure out how to do
> that
> > >>>> though.
> > >>>>>>
> > >>>>>> Anyone have an idea how to do that, even manually?
> > >>>>>>
> > >>>>>> Thoughts on all this?
> > >>>>>>
> > >>>>>> Thanks,
> > >>>>>> Gail
> > >>>>
> > >>>
> > >>
> >
>


More information about the hibernate-dev mailing list