adding my own plugin

classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|

adding my own plugin

JerodLass
This post was updated on .
I am trying to add my own plugin to gradle, extending java (though I don't know if this is completely necessary).  I have based the groovy source for my plugin and convention on those of gradle's 'groovy' and 'java' and 'war' plugins.  At this point, where do I need to put my myplugin.groovy file and/or how do I tell gradle to look for it?  I am new to build systems so feel free to assume I don't know anything and all I have are groovy files I wrote (this is pretty much the case).

I tried building this in a standalone project with gradle using the groovy plugin, hoping I could drop the resulting jar in gradle's lib folder and add a line to plugin.properties, but this didn't work for me.  I would like my plugin to extend the java plugin, and I don't know how this would work.  I have uploaded the files I have so far, Plugin1.groovy, Plugin1Convention.groovy, and my gradlefile.

Plugin1.groovy
Plugin1Convention.groovy
gradlefile

It failed when I tried compiling, and I got a strange error citing "no signature of method: java.util.HashMap.plus() is applicable for argument types: (java.util.HashMap) values: {["debug":"true"]}"
on the line:

javac([source:'1.5', target:'1.5'] + ["debug":"true"]){

I'm wondering if there could be something wrong with my groovy compiler configuration...

Jerod
Reply | Threaded
Open this post in threaded view
|

Re: adding my own plugin

JerodLass
Updated post:


JerodLass wrote
I am trying to add my own plugin to gradle, extending java (though I don't know if this is completely necessary).  I have based the groovy source for my plugin and convention on those of gradle's 'groovy' and 'java' and 'war' plugins.  At this point, where do I need to put my myplugin.groovy file and/or how do I tell gradle to look for it?  I am new to build systems so feel free to assume I don't know anything and all I have are groovy files I wrote (this is pretty much the case).

I tried building this in a standalone project with gradle using the groovy plugin, hoping I could drop the resulting jar in gradle's lib folder and add a line to plugin.properties, but this didn't work for me.  I would like my plugin to extend the java plugin, and I don't know how this would work.  I have uploaded the files I have so far, Plugin1.groovy, Plugin1Convention.groovy, and my gradlefile.

Plugin1.groovy
Plugin1Convention.groovy
gradlefile

It failed when I tried compiling, and I got a strange error citing "no signature of method: java.util.HashMap.plus() is applicable for argument types: (java.util.HashMap) values: {["debug":"true"]}"
on the line:

javac([source:'1.5', target:'1.5'] + ["debug":"true"]){

I'm wondering if there could be something wrong with my groovy compiler configuration...

Jerod
Reply | Threaded
Open this post in threaded view
|

Re: adding my own plugin

JerodLass
In reply to this post by JerodLass
Any ideas?

JerodLass wrote
I am trying to add my own plugin to gradle, extending java (though I don't know if this is completely necessary).  I have based the groovy source for my plugin and convention on those of gradle's 'groovy' and 'java' and 'war' plugins.  At this point, where do I need to put my myplugin.groovy file and/or how do I tell gradle to look for it?  I am new to build systems so feel free to assume I don't know anything and all I have are groovy files I wrote (this is pretty much the case).

I tried building this in a standalone project with gradle using the groovy plugin, hoping I could drop the resulting jar in gradle's lib folder and add a line to plugin.properties, but this didn't work for me.  I would like my plugin to extend the java plugin, and I don't know how this would work.  I have uploaded the files I have so far, Plugin1.groovy, Plugin1Convention.groovy, and my gradlefile.

Plugin1.groovy
Plugin1Convention.groovy
gradlefile

It failed when I tried compiling, and I got a strange error citing "no signature of method: java.util.HashMap.plus() is applicable for argument types: (java.util.HashMap) values: {["debug":"true"]}"
on the line:

javac([source:'1.5', target:'1.5'] + ["debug":"true"]){

I'm wondering if there could be something wrong with my groovy compiler configuration...

Jerod
Reply | Threaded
Open this post in threaded view
|

Re: adding my own plugin

Ittay Dror
In reply to this post by JerodLass

JerodLass wrote
I am trying to add my own plugin to gradle, extending java (though I don't know if this is completely necessary).  I have based the groovy source for my plugin and convention on those of gradle's 'groovy' and 'java' and 'war' plugins.  At this point, where do I need to put my myplugin.groovy file and/or how do I tell gradle to look for it?  I am new to build systems so feel free to assume I don't know anything and all I have are groovy files I wrote (this is pretty much the case).
I think you can put your groovy files under buildSrc/src/main/groovy in the root directory of your build. These are compiled by the gradle infrastructure and added to the class path.

Ittay
Reply | Threaded
Open this post in threaded view
|

Re: adding my own plugin

JerodLass
Do I then need to rebuild gradle every time I change my plugin?

Ittay Dror wrote
JerodLass wrote
I am trying to add my own plugin to gradle, extending java (though I don't know if this is completely necessary).  I have based the groovy source for my plugin and convention on those of gradle's 'groovy' and 'java' and 'war' plugins.  At this point, where do I need to put my myplugin.groovy file and/or how do I tell gradle to look for it?  I am new to build systems so feel free to assume I don't know anything and all I have are groovy files I wrote (this is pretty much the case).
I think you can put your groovy files under buildSrc/src/main/groovy in the root directory of your build. These are compiled by the gradle infrastructure and added to the class path.

Ittay
Reply | Threaded
Open this post in threaded view
|

Re: adding my own plugin

Ittay Dror
Hi Jerod,
JerodLass wrote
Do I then need to rebuild gradle every time I change my plugin?
No, it automatically compiles the classes at the start of the build. See
BuildSourceBuilder and the buildSrc directory in gradle itself.

Ittay
Reply | Threaded
Open this post in threaded view
|

Re: adding my own plugin

JerodLass
I dropped them in there and in some nearby directories and nothing happened.  It doesn't appear to be compiling my buildSrc folder because I can put typing errors in the files and still no messages.  Do I have to enable the buildSrc mechanism or something?

Jerod

Ittay Dror wrote
Hi Jerod,
JerodLass wrote
Do I then need to rebuild gradle every time I change my plugin?
No, it automatically compiles the classes at the start of the build. See
BuildSourceBuilder and the buildSrc directory in gradle itself.

Ittay
Reply | Threaded
Open this post in threaded view
|

Re: adding my own plugin

hans_d
Administrator

On Jun 17, 2008, at 8:59 PM, JerodLass wrote:

>
> I dropped them in there and in some nearby directories and nothing  
> happened.
> It doesn't appear to be compiling my buildSrc folder because I can put
> typing errors in the files and still no messages.  Do I have to  
> enable the
> buildSrc mechanism or something?

First of all sorry that I've missed this whole thread and haven't  
been answering.

You need to place your classes under buildSrc/src/main/groovy.

I gonna write more on this tomorrow.

- Hans

>
> Jerod
>
>
> Ittay Dror wrote:
>>
>> Hi Jerod,
>>
>> JerodLass wrote:
>>>
>>> Do I then need to rebuild gradle every time I change my plugin?
>>>
>> No, it automatically compiles the classes at the start of the  
>> build. See
>> BuildSourceBuilder and the buildSrc directory in gradle itself.
>>
>> Ittay
>>
>
> --
> View this message in context: http://www.nabble.com/adding-my-own- 
> plugin-tp17809485p17932933.html
> Sent from the gradle-user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

--
Hans Dockter
Gradle Project lead
http://www.gradle.org





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: adding my own plugin

Ittay Dror
Hi Hans,

I always see the message 'No build sources found.', but afterwards the build sources are compiled.

Ittay
hdockter wrote
On Jun 17, 2008, at 8:59 PM, JerodLass wrote:

>
> I dropped them in there and in some nearby directories and nothing  
> happened.
> It doesn't appear to be compiling my buildSrc folder because I can put
> typing errors in the files and still no messages.  Do I have to  
> enable the
> buildSrc mechanism or something?

First of all sorry that I've missed this whole thread and haven't  
been answering.

You need to place your classes under buildSrc/src/main/groovy.

I gonna write more on this tomorrow.

- Hans

>
> Jerod
>
>
> Ittay Dror wrote:
>>
>> Hi Jerod,
>>
>> JerodLass wrote:
>>>
>>> Do I then need to rebuild gradle every time I change my plugin?
>>>
>> No, it automatically compiles the classes at the start of the  
>> build. See
>> BuildSourceBuilder and the buildSrc directory in gradle itself.
>>
>> Ittay
>>
>
> --
> View this message in context: http://www.nabble.com/adding-my-own- 
> plugin-tp17809485p17932933.html
> Sent from the gradle-user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

--
Hans Dockter
Gradle Project lead
http://www.gradle.org





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: adding my own plugin

hans_d
Administrator

On Jun 18, 2008, at 5:27 AM, Ittay Dror wrote:

>
> Hi Hans,
>
> I always see the message 'No build sources found.', but afterwards  
> the build
> sources are compiled.

If you compile a project without build sources the log is like this:

noname:~/java/gradle/samples/tutorial hans$ gradle -bhello.gradle hello
Modern compiler found.
Recursive: true
Buildfilename: hello.gradle
No build sources found.
...

If there are build sources the message is like this:

================================================== Start building  
buildSrc
No build sources found.
:: loading settings :: url = jar:file:/Users/hans/java/gradle-
SNAPSHOT/lib/ivy-2.0.0.beta2_20080305165542.jar!/org/apache/ivy/core/
settings/ivysettings.xml
:: resolving dependencies :: org.gradle#build;SNAPSHOT
         confs: [build]
...

The first line indicated that there are build sources to compile.  
What Gradle does then is to execute a normal build using buildSrc as  
the project dir.  The line  'No build sources found.' indicates, that  
the buildSrc folder has no buildSrc subfolder with build sources.

I know this is somehow confusing. We might change the level of this  
log statement to debug.

- Hans

>
> Ittay
>
> hdockter wrote:
>>
>>
>> On Jun 17, 2008, at 8:59 PM, JerodLass wrote:
>>
>>>
>>> I dropped them in there and in some nearby directories and nothing
>>> happened.
>>> It doesn't appear to be compiling my buildSrc folder because I  
>>> can put
>>> typing errors in the files and still no messages.  Do I have to
>>> enable the
>>> buildSrc mechanism or something?
>>
>> First of all sorry that I've missed this whole thread and haven't
>> been answering.
>>
>> You need to place your classes under buildSrc/src/main/groovy.
>>
>> I gonna write more on this tomorrow.
>>
>> - Hans
>>
>>>
>>> Jerod
>>>
>>>
>>> Ittay Dror wrote:
>>>>
>>>> Hi Jerod,
>>>>
>>>> JerodLass wrote:
>>>>>
>>>>> Do I then need to rebuild gradle every time I change my plugin?
>>>>>
>>>> No, it automatically compiles the classes at the start of the
>>>> build. See
>>>> BuildSourceBuilder and the buildSrc directory in gradle itself.
>>>>
>>>> Ittay
>>>>
>>>
>>> --
>>> View this message in context: http://www.nabble.com/adding-my-own-
>>> plugin-tp17809485p17932933.html
>>> Sent from the gradle-user mailing list archive at Nabble.com.
>>>
>>>
>>> --------------------------------------------------------------------
>>> -
>>> To unsubscribe from this list, please visit:
>>>
>>>     http://xircles.codehaus.org/manage_email
>>>
>>>
>>
>> --
>> Hans Dockter
>> Gradle Project lead
>> http://www.gradle.org
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/adding-my-own- 
> plugin-tp17809485p17959065.html
> Sent from the gradle-user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

--
Hans Dockter
Gradle Project lead
http://www.gradle.org





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: adding my own plugin

Ittay Dror

hdockter wrote
The first line indicated that there are build sources to compile.  
What Gradle does then is to execute a normal build using buildSrc as  
the project dir.  The line  'No build sources found.' indicates, that  
the buildSrc folder has no buildSrc subfolder with build sources.

I know this is somehow confusing. We might change the level of this  
log statement to debug.
or maybe prevent building build source files in recursive invocations of gradle.

ittay
Reply | Threaded
Open this post in threaded view
|

Re: adding my own plugin

hans_d
Administrator
In reply to this post by JerodLass
Hi Jerod,

On Jun 17, 2008, at 5:36 PM, JerodLass wrote:

>
> Any ideas?
>
>
> JerodLass wrote:
>>
>> I am trying to add my own plugin to gradle, extending java (though  
>> I don't
>> know if this is completely necessary).  I have based the groovy  
>> source for
>> my plugin and convention on those of gradle's 'groovy' and 'java' and
>> 'war' plugins.  At this point, where do I need to put my  
>> myplugin.groovy
>> file and/or how do I tell gradle to look for it?  I am new to build
>> systems so feel free to assume I don't know anything and all I  
>> have are
>> groovy files I wrote (this is pretty much the case).

there are two ways to add something to the build script classpath. Be  
it a plugin or any other code.

1.) Via a settings.gradle file (in the root dir of _your_ project)
2.) Via the buildSrc folder (in the root dir of _your_ project)

See also chapter 15 of the user's guide.

If a plugin is somewhere in the buildscript classpath you can call it  
with:

usePlugin('com.jerod.MyPlugin')

You don't need to modify the plugin.properties file.

>>
>> I tried building this in a standalone project with gradle using  
>> the groovy
>> plugin, hoping I could drop the resulting jar in gradle's lib  
>> folder and
>> add a line to plugin.properties, but this didn't work for me.  I  
>> would
>> like my plugin to extend the java plugin, and I don't know how  
>> this would
>> work.  I have uploaded the files I have so far, Plugin1.groovy,
>> Plugin1Convention.groovy, and my gradlefile.
>>
>>  http://www.nabble.com/file/p17809485/Plugin1.groovy Plugin1.groovy
>>  http://www.nabble.com/file/p17809485/Plugin1Convention.groovy
>> Plugin1Convention.groovy
>>  http://www.nabble.com/file/p17809485/gradlefile gradlefile
>>
>> It failed when I tried compiling, and I got a strange error citing  
>> "no
>> signature of method: java.util.HashMap.plus() is applicable for  
>> argument
>> types: (java.util.HashMap) values: {["debug":"true"]}"
>> on the line:
>>
>> javac([source:'1.5', target:'1.5'] + ["debug":"true"]){

This looks like a correct statement. Could you paste more of this  
snippet?

>>
>> I'm wondering if there could be something wrong with my groovy  
>> compiler
>> configuration...
>>
>> Jerod
>>
>
> --
> View this message in context: http://www.nabble.com/adding-my-own- 
> plugin-tp17809485p17916444.html
> Sent from the gradle-user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

--
Hans Dockter
Gradle Project lead
http://www.gradle.org





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: adding my own plugin

hans_d
Administrator
In reply to this post by Ittay Dror

On Jun 18, 2008, at 6:03 AM, Ittay Dror wrote:

>
>
>
> hdockter wrote:
>>
>> The first line indicated that there are build sources to compile.
>> What Gradle does then is to execute a normal build using buildSrc as
>> the project dir.  The line  'No build sources found.' indicates, that
>> the buildSrc folder has no buildSrc subfolder with build sources.
>>
>> I know this is somehow confusing. We might change the level of this
>> log statement to debug.
>>
> or maybe prevent building build source files in recursive  
> invocations of
> gradle.

Even though I don't see a use case I don't want to limit the freedom  
of what one can do, if not really necessary.

- Hans

>
> ittay
>
> --
> View this message in context: http://www.nabble.com/adding-my-own- 
> plugin-tp17809485p17959337.html
> Sent from the gradle-user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

--
Hans Dockter
Gradle Project lead
http://www.gradle.org





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: adding my own plugin

hans_d
Administrator
In reply to this post by JerodLass

On Jun 17, 2008, at 7:07 PM, JerodLass wrote:

>
> Do I then need to rebuild gradle every time I change my plugin?

As said in the other mail. You use the buildSrc root folder of your  
project not of Gradle.

The question is, if there are multiple projects supposed to use your  
plugin or not. If so, it would make sense to have a stand alone build  
for your plugin. The resulting jar could be uploaded to a repository.  
Via the settings.gradle file you would add this jar to the build  
script classpath of the other projects. If only a single project  
needs this plugin, it might be not necessary to use a plugin at all.  
After all you can create the tasks and properties directly in your  
project build script, possibly using helper classes defined in the  
buildScr folder.

- Hans

>
>
> Ittay Dror wrote:
>>
>>
>>
>> JerodLass wrote:
>>>
>>> I am trying to add my own plugin to gradle, extending java (though I
>>> don't know if this is completely necessary).  I have based the  
>>> groovy
>>> source for my plugin and convention on those of gradle's 'groovy'  
>>> and
>>> 'java' and 'war' plugins.  At this point, where do I need to put my
>>> myplugin.groovy file and/or how do I tell gradle to look for it?  
>>> I am
>>> new to build systems so feel free to assume I don't know anything  
>>> and all
>>> I have are groovy files I wrote (this is pretty much the case).
>>>
>> I think you can put your groovy files under buildSrc/src/main/
>> groovy in
>> the root directory of your build. These are compiled by the gradle
>> infrastructure and added to the class path.
>>
>> Ittay
>>
>
> --
> View this message in context: http://www.nabble.com/adding-my-own- 
> plugin-tp17809485p17921481.html
> Sent from the gradle-user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

--
Hans Dockter
Gradle Project lead
http://www.gradle.org





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: adding my own plugin

JerodLass

hdockter wrote
As said in the other mail. You use the buildSrc root folder of your  
project not of Gradle.

The question is, if there are multiple projects supposed to use your  
plugin or not. If so, it would make sense to have a stand alone build  
for your plugin. The resulting jar could be uploaded to a repository.  
Via the settings.gradle file you would add this jar to the build  
script classpath of the other projects. If only a single project  
needs this plugin, it might be not necessary to use a plugin at all.  
After all you can create the tasks and properties directly in your  
project build script, possibly using helper classes defined in the  
buildScr folder.

- Hans

Hans Dockter
Gradle Project lead
http://www.gradle.org
I would like to have a standalone build for this plugin if I can.  This is also how I plan on separating out common build logic for all projects I might work with.  I've changed my plugin project a lot as well as the build script and I have a different error, which I have included a screenshot of:

pluginerror.JPG
build.gradle

When I get this working, what do I need to put in the settings.gradle file in order for it to recognize the plugin?  I only have experience adding dependencies as they relate to java compilation, so where do I need to put the plugin.jar or how do I get it from the repository before gradle starts looking for it?  I appreciate all of this help very much.

-Jerod
Reply | Threaded
Open this post in threaded view
|

Re: adding my own plugin

hans_d
Administrator

On Jun 18, 2008, at 3:52 PM, JerodLass wrote:

>
>
>
> hdockter wrote:
>>
>>
>> As said in the other mail. You use the buildSrc root folder of your
>> project not of Gradle.
>>
>> The question is, if there are multiple projects supposed to use your
>> plugin or not. If so, it would make sense to have a stand alone build
>> for your plugin. The resulting jar could be uploaded to a repository.
>> Via the settings.gradle file you would add this jar to the build
>> script classpath of the other projects. If only a single project
>> needs this plugin, it might be not necessary to use a plugin at all.
>> After all you can create the tasks and properties directly in your
>> project build script, possibly using helper classes defined in the
>> buildScr folder.
>>
>> - Hans
>>
>> Hans Dockter
>> Gradle Project lead
>> http://www.gradle.org
>>
>>
>
> I would like to have a standalone build for this plugin if I can.  
> This is
> also how I plan on separating out common build logic for all  
> projects I
> might work with.  I've changed my plugin project a lot as well as  
> the build
> script and I have a different error, which I have included a  
> screenshot of:
>
> http://www.nabble.com/file/p17983171/pluginerror.JPG pluginerror.JPG
> http://www.nabble.com/file/p17983171/build.gradle build.gradle

The groovy jar is not in your classpath. See the first paragraph of  
chapter 10 in the user's guide.

>
> When I get this working, what do I need to put in the  
> settings.gradle file
> in order for it to recognize the plugin?

Nothing special. You just have to add the jar to the build script  
classpath.

settings.gradle:
dependencies('org.jerod:mavenPlugin:1.0')

build.gradle:
usePlugin('org.jerod.MyMavenPlugin') // fully qualified name your  
plugin class.

See also chapter 15 of the user's guide.

- Hans

> I only have experience adding
> dependencies as they relate to java compilation, so where do I need  
> to put
> the plugin.jar or how do I get it from the repository before gradle  
> starts
> looking for it?  I appreciate all of this help very much.
>
> -Jerod
> --
> View this message in context: http://www.nabble.com/adding-my-own- 
> plugin-tp17809485p17983171.html
> Sent from the gradle-user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

--
Hans Dockter
Gradle Project lead
http://www.gradle.org





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: adding my own plugin

JerodLass
Nothing special. You just have to add the jar to the build script  
classpath.

settings.gradle:
dependencies('org.jerod:mavenPlugin:1.0')

build.gradle:
usePlugin('org.jerod.MyMavenPlugin') // fully qualified name your  
plugin class.

See also chapter 15 of the user's guide.

- Hans
I apologize, I didn't think to look much at the groovy plugin and assumed it would operate like the java plugin.  I should have looked more at the user guide.  I have the jar now, and eventually I will be adding it to a repository but until I make sure it's right, I just put it in a project's lib folder, which gets found and added in the settings.gradle file:

addFlatDirResolver('lib', new File(rootDir, 'lib'))
dependencies('org.jerod:MavenPlugin:1.0')

This seems to be working, and I declare the plugin in my build.gradle file as:

usePlugin('org.jerod.MavenPOMPlugin')

That is the name of the plugin and the location within the MavenPlugin-1.0.jar that gets resolved.  This results in the following error:

nopluginid.JPG

Do I have to do something different in the class itself to let gradle know it's a plugin?  It extends the JavaPlugin, but other than that I don't know how to let gradle know it's a plugin.  Or maybe I have more errors in my file structure, I'm not sure.
Reply | Threaded
Open this post in threaded view
|

Re: adding my own plugin

hans_d
Administrator

On Jun 18, 2008, at 5:02 PM, JerodLass wrote:

>
>
>
>> Nothing special. You just have to add the jar to the build script
>> classpath.
>>
>> settings.gradle:
>> dependencies('org.jerod:mavenPlugin:1.0')
>>
>> build.gradle:
>> usePlugin('org.jerod.MyMavenPlugin') // fully qualified name your
>> plugin class.
>>
>> See also chapter 15 of the user's guide.
>>
>> - Hans
>>
>>
>
> I apologize, I didn't think to look much at the groovy plugin and  
> assumed it
> would operate like the java plugin.  I should have looked more at  
> the user
> guide.  I have the jar now, and eventually I will be adding it to a
> repository but until I make sure it's right, I just put it in a  
> project's
> lib folder, which gets found and added in the settings.gradle file:
>
> addFlatDirResolver('lib', new File(rootDir, 'lib'))
> dependencies('gradleplugins:MavenPlugin:1.0')
>
> This seems to be working, and I declare the plugin in my  
> build.gradle file
> as:
>
> usePlugin('org.jerod.MavenPOMPlugin')
>
> That is the name of the plugin and the location within the
> MavenPlugin-1.0.jar that gets resolved.  This results in the following
> error:
>
> http://www.nabble.com/file/p17984628/nopluginid.JPG nopluginid.JPG
>
> Do I have to do something different in the class itself to let  
> gradle know
> it's a plugin?  It extends the JavaPlugin, but other than that I  
> don't know
> how to let gradle know it's a plugin.  Or maybe I have more errors  
> in my
> file structure, I'm not sure.

I have the same problem. I have to check what is wrong. Talk to you  
soon.

- Hans

> --
> View this message in context: http://www.nabble.com/adding-my-own- 
> plugin-tp17809485p17984628.html
> Sent from the gradle-user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

--
Hans Dockter
Gradle Project lead
http://www.gradle.org





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: adding my own plugin

hans_d
Administrator

On Jun 18, 2008, at 5:38 PM, Hans Dockter wrote:

>
> On Jun 18, 2008, at 5:02 PM, JerodLass wrote:
>
>>
>>
>>
>>> Nothing special. You just have to add the jar to the build script
>>> classpath.
>>>
>>> settings.gradle:
>>> dependencies('org.jerod:mavenPlugin:1.0')
>>>
>>> build.gradle:
>>> usePlugin('org.jerod.MyMavenPlugin') // fully qualified name your
>>> plugin class.
>>>
>>> See also chapter 15 of the user's guide.
>>>
>>> - Hans
>>>
>>>
>>
>> I apologize, I didn't think to look much at the groovy plugin and  
>> assumed it
>> would operate like the java plugin.  I should have looked more at  
>> the user
>> guide.  I have the jar now, and eventually I will be adding it to a
>> repository but until I make sure it's right, I just put it in a  
>> project's
>> lib folder, which gets found and added in the settings.gradle file:
>>
>> addFlatDirResolver('lib', new File(rootDir, 'lib'))
>> dependencies('gradleplugins:MavenPlugin:1.0')
>>
>> This seems to be working, and I declare the plugin in my  
>> build.gradle file
>> as:
>>
>> usePlugin('org.jerod.MavenPOMPlugin')

Fortunately this is no bug. Sorry for mailing a buggy snippet in my  
earlier email.

This should do the job:

usePlugin(org.jerod.MavenPOMPlugin) // without quotations

- Hans

>>
>> That is the name of the plugin and the location within the
>> MavenPlugin-1.0.jar that gets resolved.  This results in the  
>> following
>> error:
>>
>> http://www.nabble.com/file/p17984628/nopluginid.JPG nopluginid.JPG
>>
>> Do I have to do something different in the class itself to let  
>> gradle know
>> it's a plugin?  It extends the JavaPlugin, but other than that I  
>> don't know
>> how to let gradle know it's a plugin.  Or maybe I have more errors  
>> in my
>> file structure, I'm not sure.
>
> I have the same problem. I have to check what is wrong. Talk to you  
> soon.
>
> - Hans
>
>> --
>> View this message in context: http://www.nabble.com/adding-my-own- 
>> plugin-tp17809485p17984628.html
>> Sent from the gradle-user mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>
> --
> Hans Dockter
> Gradle Project lead
> http://www.gradle.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

--
Hans Dockter
Gradle Project lead
http://www.gradle.org





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: adding my own plugin

JerodLass
Getting close... I now have:
groovyCallSiteError.JPG
Is this a problem with my plugin itself? A very similar plugin worked fine with I put it in gradle's source and rebuilt it last week.

hdockter wrote
On Jun 18, 2008, at 5:38 PM, Hans Dockter wrote:

>
> On Jun 18, 2008, at 5:02 PM, JerodLass wrote:
>
>>
>>
>>
>>> Nothing special. You just have to add the jar to the build script
>>> classpath.
>>>
>>> settings.gradle:
>>> dependencies('org.jerod:mavenPlugin:1.0')
>>>
>>> build.gradle:
>>> usePlugin('org.jerod.MyMavenPlugin') // fully qualified name your
>>> plugin class.
>>>
>>> See also chapter 15 of the user's guide.
>>>
>>> - Hans
>>>
>>>
>>
>> I apologize, I didn't think to look much at the groovy plugin and  
>> assumed it
>> would operate like the java plugin.  I should have looked more at  
>> the user
>> guide.  I have the jar now, and eventually I will be adding it to a
>> repository but until I make sure it's right, I just put it in a  
>> project's
>> lib folder, which gets found and added in the settings.gradle file:
>>
>> addFlatDirResolver('lib', new File(rootDir, 'lib'))
>> dependencies('gradleplugins:MavenPlugin:1.0')
>>
>> This seems to be working, and I declare the plugin in my  
>> build.gradle file
>> as:
>>
>> usePlugin('org.jerod.MavenPOMPlugin')

Fortunately this is no bug. Sorry for mailing a buggy snippet in my  
earlier email.

This should do the job:

usePlugin(org.jerod.MavenPOMPlugin) // without quotations

- Hans

>>
>> That is the name of the plugin and the location within the
>> MavenPlugin-1.0.jar that gets resolved.  This results in the  
>> following
>> error:
>>
>> http://www.nabble.com/file/p17984628/nopluginid.JPG nopluginid.JPG
>>
>> Do I have to do something different in the class itself to let  
>> gradle know
>> it's a plugin?  It extends the JavaPlugin, but other than that I  
>> don't know
>> how to let gradle know it's a plugin.  Or maybe I have more errors  
>> in my
>> file structure, I'm not sure.
>
> I have the same problem. I have to check what is wrong. Talk to you  
> soon.
>
> - Hans
>
>> --
>> View this message in context: http://www.nabble.com/adding-my-own- 
>> plugin-tp17809485p17984628.html
>> Sent from the gradle-user mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>
> --
> Hans Dockter
> Gradle Project lead
> http://www.gradle.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

--
Hans Dockter
Gradle Project lead
http://www.gradle.org





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

12