Quantcast
Channel: Gradle Forums - Latest posts
Viewing all articles
Browse latest Browse all 20603

Defining Consumer from Groovy build.gradle

$
0
0

I tried adding to: to the #apply call, but that did not work for me.

if ( pathName.endsWith( ".profile" ) || pathName.endsWith( ".gradle" ) ) {
    project.apply( Helper.asMap( "from", path, "to", dslExtension.getProfiles() ) );
    ...
}

and in one of these files:

h2 {
    hibernateProperty ...
    dependency 'com.h2database:h2:1.4.196'
    ...
}

But end up with:

* What went wrong:
A problem occurred evaluating script.
> Could not find method h2() for arguments [profile_3zuremxljk3s5vzzp1lhlqr9o$_run_closure1@59a2c35d] on object of type org.hibernate.testing.db.Profile.

So it seems like passing the NamedDomainObjectContainer as the to target somehow thinks the NamedDomainObjectContainer is one of the contained domain objects.

Am I just doing something wrong?

It does work if do not specify to and have the fragments do the full databases/profiles/h2 naming. Meaning, this works:

databases {
    profiles {
        h2 {
            ...
        }
    }
}

Were you expecting that I’d pass something other than the NamedDomainObjectContainer as to?


Viewing all articles
Browse latest Browse all 20603

Trending Articles