I see. Actually, I kind of like that a little bit better. I tried creating a
configuration for the plugin:
[code src='apply.groovy']
configurations { gradleTemplates }
repositories {
   ivy {
      name = 'gradle_templates'
      artifactPattern "
http://launchpad.net/[organization]/trunk/[revision]/+download/[artifact]-[revision].jar
"
   }
}
dependencies {
   gradleTemplates 'gradle-templates:templates:1.1'
}
apply plugin: 'templates'
[/code]

This works fine. Is this preferred? Or should I still create an issue for
the script classpath?

Thanks,
Eric

On Mon, Oct 24, 2011 at 12:30 PM, Adam Murdoch
<[email protected]>wrote:

>
> On 25/10/2011, at 5:25 AM, Eric Berry wrote:
>
> I'm trying to update the gradle-templates (and the gradle-release) plugin
> to work for Gradle 1.0 M5. My understanding is that the easiest way to get
> plugins installed now is to use an 'apply from' script, but my script seems
> to be failing with milestone-5 (20111024073824+0200).
>
> Running 'gradle tasks' yeilds:
> [quote]
> [508] gradle tasks
> SimpleHttpConnectionManager being used incorrectly.  Be sure that
> HttpMethod.releaseConnection() is always called and that only one thread
> and/or method is using this connection manager at a time.
> Download
> http://launchpad.net/gradle-templates/trunk/1.1/+download/templates-1.1.jar
>
> FAILURE: Build failed with an exception.
>
> * Where:
> Script
> '/Users/elberry/development/projects/mine/gradle-templates/installation/apply.groovy'
> line: 12
>
> * What went wrong:
> A problem occurred evaluating script.
> Cause: Plugin with id 'templates' not found.
>
> * Try:
> Run with --stacktrace option to get the stack trace. Run with --info or
> --debug option to get more log output.
>
> BUILD FAILED
>
> Total time: 6.35 secs
> [/quote]
>
> As you can see, the plugin jar file was downloaded correctly, however the
> plugin still can't be found.
>
> [code src='apply.groovy']
> buildscript {
>     repositories {
>         ivy {
>             name = 'gradle_templates'
>             artifactPattern "
> http://launchpad.net/[organization]/trunk/[revision]/+download/[artifact]-[revision].jar<http://launchpad.net/%5Borganization%5D/trunk/%5Brevision%5D/+download/%5Bartifact%5D-%5Brevision%5D.jar>
> "
>         }
>     }
>     dependencies {
>         classpath 'gradle-templates:templates:1.1'
>     }
> }
> apply plugin: 'templates'
>
>
> At the moment, the apply method uses the classpath of the project to find
> plugins, not the classpath of the script, so this isn't going to work. Could
> you add a jira issue for this problem?
>
> We should probably be looking first in the script classloader, and then in
> the project classloader. This would work for your script above.
>
> Or perhaps applying a script makes the classpath of the script available to
> the project in some way, so that you can have the buildscript { } logic in
> one script, and the apply plugin: statements in some other script. We've
> talked about doing this also to make the task types defined in one script
> available to the other scripts.
>
> Until we fix this, a work around would be to move all that stuff to the
> build.gradle. Another would be to apply the plugin by type:
>
> apply plugin: TemplatePluginClass
>
> [/code]
>
> [code src='build.gradle']
> apply from:
> 'file:///Users/elberry/development/projects/mine/gradle-templates/installation/apply.groovy'
> [/code]
>
> Not sure what I'm doing wrong here, any help would be greatly appreciated.
>
> Thanks,
> Eric
>
> --
> Learn from the past. Live in the present. Plan for the future.
> Blog: http://eric-berry.blogspot.com
> jEdit <http://www.jedit.org> - Programmer's Text Editor
> Bazaar <http://bazaar.canonical.com> - Version Control for Humans
>
>
>
> --
> Adam Murdoch
> Gradle Co-founder
> http://www.gradle.org
> VP of Engineering, Gradleware Inc. - Gradle Training, Support, Consulting
> http://www.gradleware.com
>
>


-- 
Learn from the past. Live in the present. Plan for the future.
Blog: http://eric-berry.blogspot.com
jEdit <http://www.jedit.org> - Programmer's Text Editor
Bazaar <http://bazaar.canonical.com> - Version Control for Humans

Reply via email to