On 11/04/2011, at 4:37 AM, Ronen Narkis wrote:

> Ok iv seemed to find the right call:
> 
> this.class.classLoader.getResourceAsStream

This is always a better option for locating resources, rather than using 
getSystemResource(), as it makes fewer assumptions about which ClassLoader your 
classes and resources will be loaded by.

> 
> Works as expected 
> 
> On a side note, what is the correct way of verifying the plugin after 
> incremental changes (Im writing tests but somtimes id like to run them on a 
> live project to track issue like classloading). 
> 
> Is there a mavem install like functionality im missing? 

If you apply the maven plugin, you get an install task, which you can use to 
publish to the local maven repository. You can then use mavenLocal() in the 
repositories section of your other project to resolve the artifacts from there.

This is something we want to make easier before the Gradle 1.0 release. We want 
to provide some way to define an aggregate build, made up of the two separate 
builds, so that you can build them together in one go. Essentially, this would 
work as a multi-project build, where Gradle would replace an external 
dependency, say, 'mygroup:myplugin:1.0-snapshot', with the appropriate project 
dependency.


> 
> right now im uploading the plugin to artifactory and clearing the local cache 
> each time to see the latest changes, I guess that I could right a plugin that 
> deploys the jar to the gradle cache folder, is that the correct approach?
> 
> Thanks
> Ronen
> 
> On Sun, Apr 10, 2011 at 8:18 PM, M A <[email protected]> wrote:
> Are you providing us with the correct code snippet? Your plugin source won't 
> be available to your users.
> 
> On Apr 10, 2011 8:51 AM, "Ronen Narkis" <[email protected]> wrote:
> > Hey,
> > 
> > Im writing a custom plugin that has file resources under:
> > 
> > src/main/resource/com/some/path/file.text
> > 
> > During tests I can load the file by using:
> > 
> > 
> > def apply() {
> > URL url =
> > ClassLoader.getSystemResource('com/kenshoo/liquibase/LiquibaseApi.java')
> > }
> > 
> > However when applying the plugin in an actual project im getting null value
> > 
> > Any idea on how to solve this?
> > 
> > Thanks
> > Ronen
> 


--
Adam Murdoch
Gradle Co-founder
http://www.gradle.org
VP of Engineering, Gradleware Inc. - Gradle Training, Support, Consulting
http://www.gradleware.com

Reply via email to