Including Grails src/java class in a Gant script

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Including Grails src/java class in a Gant script

jondo_w
I'm writing a plugin script that interrogates various controller classes and outputs a properties file as a convenience for the user. This 'interrogation' of the controller classes involves looking for a custom annotation which is defined in my /src/java folder.

When I run my Gant script, it complains that:

Error executing script CreateActionMappings: startup failed:
CreateActionMappings: 108: unable to resolve class org.grails.plugins.authorize.
AuthRequired
 @ line 108, column 59.
CreateActionMappings: 108: unable to resolve class org.grails.plugins.authorize.
AuthRequired
 @ line 108, column 85.
2 errors

So how do I include the src/java classes to use in my Gant script? And yes, I realize that src/java is the source folder, not the class folder. I had tried to:

includeTargets << grailsScript("Init")
includeTargets << grailsScript("Bootstrap")

and do a:

depends(classpath, bootstrap)

but this did not help. Still got the same error.

Many thanks,
Darryl

Reply | Threaded
Open this post in threaded view
|

Re: Including Grails src/java class in a Gant script

Lim Chee Kin
Hi,

I am facing the same problem for Groovy class located in /src/groovy folder. But no solution yet.

Regards,
Chee Kin
Reply | Threaded
Open this post in threaded view
|

Re: Including Grails src/java class in a Gant script

ld@ldaley.com
In reply to this post by jondo_w
You need to load the class dynamically using:

def myClass = classLoader.loadClass("org.my.My")

On 10/10/2010, at 8:14 PM, Darryl Pentz <[hidden email]> wrote:

I'm writing a plugin script that interrogates various controller classes and outputs a properties file as a convenience for the user. This 'interrogation' of the controller classes involves looking for a custom annotation which is defined in my /src/java folder.

When I run my Gant script, it complains that:

Error executing script CreateActionMappings: startup failed:
CreateActionMappings: 108: unable to resolve class org.grails.plugins.authorize.
AuthRequired
 @ line 108, column 59.
CreateActionMappings: 108: unable to resolve class org.grails.plugins.authorize.
AuthRequired
 @ line 108, column 85.
2 errors

So how do I include the src/java classes to use in my Gant script? And yes, I realize that src/java is the source folder, not the class folder. I had tried to:

includeTargets << grailsScript("Init")
includeTargets << grailsScript("Bootstrap")

and do a:

depends(classpath, bootstrap)

but this did not help. Still got the same error.

Many thanks,
Darryl

Reply | Threaded
Open this post in threaded view
|

Re: Including Grails src/java class in a Gant script

Lim Chee Kin
Thanks, Luke. It works!

Regards,
Chee Kin


On Mon, Oct 11, 2010 at 6:34 AM, Luke Daley [via Grails] <[hidden email]> wrote:
You need to load the class dynamically using:

def myClass = classLoader.loadClass("org.my.My")

On 10/10/2010, at 8:14 PM, Darryl Pentz <[hidden email]> wrote:

I'm writing a plugin script that interrogates various controller classes and outputs a properties file as a convenience for the user. This 'interrogation' of the controller classes involves looking for a custom annotation which is defined in my /src/java folder.

When I run my Gant script, it complains that:

Error executing script CreateActionMappings: startup failed:
CreateActionMappings: 108: unable to resolve class org.grails.plugins.authorize.
AuthRequired
 @ line 108, column 59.
CreateActionMappings: 108: unable to resolve class org.grails.plugins.authorize.
AuthRequired
 @ line 108, column 85.
2 errors

So how do I include the src/java classes to use in my Gant script? And yes, I realize that src/java is the source folder, not the class folder. I had tried to:

includeTargets << grailsScript("Init")
includeTargets << grailsScript("Bootstrap")

and do a:

depends(classpath, bootstrap)

but this did not help. Still got the same error.

Many thanks,
Darryl




View message @ http://grails.1312388.n4.nabble.com/Including-Grails-src-java-class-in-a-Gant-script-tp2970142p2970711.html
To unsubscribe from Including Grails src/java class in a Gant script, click here.


Reply | Threaded
Open this post in threaded view
|

Re: Including Grails src/java class in a Gant script

Russel Winder
If the result of the thread below, and indeed any other ones like it,
are requirements for new functionality in Gant, then feel free to post
JIRA issues in the Gant project area.  Having patches for merging or
better still pull requests from Git clones of the mainline repository,
is the best fillip to further development of Gant.

Currently Gant development looks stalled because it is.  I am ensuring
that the build continues to work with the evolution of Gradle, and
repairing any test failures as Groovy evolves, but there is no
development work happening on the code base.  Of the 18 open issues only
a couple are serious and as there seems no-one interested in getting
them fixed, there is no incentive to work on them, especially as no-one
else seems interested in working on the code.

On Sun, 2010-10-10 at 19:57 -0700, Lim Chee Kin wrote:

> Thanks, Luke. It works!
>
> Regards,
> Chee Kin
>
>
> On Mon, Oct 11, 2010 at 6:34 AM, Luke Daley [via Grails] <[hidden
> email]> wrote:
>         You need to load the class dynamically using:
>        
>        
>         def myClass = classLoader.loadClass("org.my.My")
>        
>         On 10/10/2010, at 8:14 PM, Darryl Pentz <[hidden email]>
>         wrote:
>        
>        
>        
>         > I'm writing a plugin script that interrogates various
>         > controller classes and outputs a properties file as a
>         > convenience for the user. This 'interrogation' of the
>         > controller classes involves looking for a custom annotation
>         > which is defined in my /src/java folder.
>         >
>         > When I run my Gant script, it complains that:
>         >
>         > Error executing script CreateActionMappings: startup failed:
>         > CreateActionMappings: 108: unable to resolve class
>         > org.grails.plugins.authorize.
>         > AuthRequired
>         >  @ line 108, column 59.
>         > CreateActionMappings: 108: unable to resolve class
>         > org.grails.plugins.authorize.
>         > AuthRequired
>         >  @ line 108, column 85.
>         > 2 errors
>         >
>         >
>         > So how do I include the src/java classes to use in my Gant
>         > script? And yes, I realize that src/java is the source
>         > folder, not the class folder. I had tried to:
>         >
>         > includeTargets << grailsScript("Init")
>         > includeTargets << grailsScript("Bootstrap")
>         >
>         >
>         > and do a:
>         >
>         > depends(classpath, bootstrap)
>         >
>         >
>         > but this did not help. Still got the same error.
>         >
>         > Many thanks,
>         > Darryl

--
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:[hidden email]
41 Buckmaster Road    m: +44 7770 465 077   xmpp: [hidden email]
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Including Grails src/java class in a Gant script

ld@ldaley.com
Hi Russel,

Gant is not at fault here. It's an artefact of application classes not always being available to “build” classes.

The situation will be better for 2.0 I believe.

On 11/10/2010, at 5:32 PM, Russel Winder wrote:

> If the result of the thread below, and indeed any other ones like it,
> are requirements for new functionality in Gant, then feel free to post
> JIRA issues in the Gant project area.  Having patches for merging or
> better still pull requests from Git clones of the mainline repository,
> is the best fillip to further development of Gant.
>
> Currently Gant development looks stalled because it is.  I am ensuring
> that the build continues to work with the evolution of Gradle, and
> repairing any test failures as Groovy evolves, but there is no
> development work happening on the code base.  Of the 18 open issues only
> a couple are serious and as there seems no-one interested in getting
> them fixed, there is no incentive to work on them, especially as no-one
> else seems interested in working on the code.
>
> On Sun, 2010-10-10 at 19:57 -0700, Lim Chee Kin wrote:
>> Thanks, Luke. It works!
>>
>> Regards,
>> Chee Kin
>>
>>
>> On Mon, Oct 11, 2010 at 6:34 AM, Luke Daley [via Grails] <[hidden
>> email]> wrote:
>>        You need to load the class dynamically using:
>>
>>
>>        def myClass = classLoader.loadClass("org.my.My")
>>
>>        On 10/10/2010, at 8:14 PM, Darryl Pentz <[hidden email]>
>>        wrote:
>>
>>
>>
>>> I'm writing a plugin script that interrogates various
>>> controller classes and outputs a properties file as a
>>> convenience for the user. This 'interrogation' of the
>>> controller classes involves looking for a custom annotation
>>> which is defined in my /src/java folder.
>>>
>>> When I run my Gant script, it complains that:
>>>
>>> Error executing script CreateActionMappings: startup failed:
>>> CreateActionMappings: 108: unable to resolve class
>>> org.grails.plugins.authorize.
>>> AuthRequired
>>> @ line 108, column 59.
>>> CreateActionMappings: 108: unable to resolve class
>>> org.grails.plugins.authorize.
>>> AuthRequired
>>> @ line 108, column 85.
>>> 2 errors
>>>
>>>
>>> So how do I include the src/java classes to use in my Gant
>>> script? And yes, I realize that src/java is the source
>>> folder, not the class folder. I had tried to:
>>>
>>> includeTargets << grailsScript("Init")
>>> includeTargets << grailsScript("Bootstrap")
>>>
>>>
>>> and do a:
>>>
>>> depends(classpath, bootstrap)
>>>
>>>
>>> but this did not help. Still got the same error.
>>>
>>> Many thanks,
>>> Darryl
>
>
> --
> Russel.
> =============================================================================
> Dr Russel Winder      t: +44 20 7585 2200   voip: sip:[hidden email]
> 41 Buckmaster Road    m: +44 7770 465 077   xmpp: [hidden email]
> London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder


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

    http://xircles.codehaus.org/manage_email