Beginner problem

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

Beginner problem

Wim Jongman
Hi,

I am a little embarrassed to ask this since I am only started with groovy dsl recently but there is this thing with the eclipse dsld that I don't understand.

I am creating an eclipse plug-in for our dsl and I have added the following dsld to inject some classes in the script as per the instructions on the web.

file: Gravity.dsld

package dsld

import com.remainsoftware.gravity.definitions.model.IDefinitionsService;
import com.remainsoftware.gravity.useradmin.model.IGravityUserAdmin;


contribute(currentType()) { 
property name : 'useradmin', type : IGravityUserAdmin, provider : 'Gravity', doc : 'This is the user admin service.'
property name : 'definitions', type : IDefinitionsService, provider : 'Gravity', doc : 'This is the instance of the definition service.'


Note that the two imports are resolved by the editor. The dsld cannot compile given the following trace. If I remove the imports, the script seems to compile fine. What could be the problem?


org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Gravity.dsld: 4: unable to resolve class com.remainsoftware.gravity.useradmin.model.IGravityUserAdmin
 @ line 4, column 51.
   tware.gravity.useradmin.model.IGravityUs
                                 ^

Gravity.dsld: 3: unable to resolve class com.remainsoftware.gravity.definitions.model.IDefinitionsService
 @ line 3, column 53.
   are.gravity.definitions.model.IDefinitio
                                 ^

2 errors

at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:306)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:949)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:596)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:545)
Reply | Threaded
Open this post in threaded view
|

Re: Beginner problem

Andrew Eisenberg
You must quote the references to the classes.  The DSLD file is
resolved using a different classpath from your actual project.  This
is because DSLD scripts are classloaded by Eclipse.  It would be
unsafe to add the project you are editing to the classpath of your
running Eclipse instance.

So, when types defined in your project need to be referenced, they
need to be done as Strings.

The DSLD classpath includes the groovy jars, the JDK, and a portion of
Eclipse.  Unfortunately, the confusing part is that the editor
resolves the DSLD using the classpath of the project.  You can read
more about it on the documentation:
http://docs.codehaus.org/display/GROOVY/DSL+Descriptors+for+Groovy-Eclipse

Currently, I don't seem to have access to that page, so I can't
provide a better link for you that will take you to the location where
this is actually explained, but it is in an info box somewhere in the
middle of the document.

Let me know if this fixes your problem.

On Thu, Mar 22, 2012 at 11:11 AM, Wim Jongman <[hidden email]> wrote:

> Hi,
>
> I am a little embarrassed to ask this since I am only started with groovy
> dsl recently but there is this thing with the eclipse dsld that I don't
> understand.
>
> I am creating an eclipse plug-in for our dsl and I have added the following
> dsld to inject some classes in the script as per the instructions on the
> web.
>
> file: Gravity.dsld
>
> package dsld
>
> import com.remainsoftware.gravity.definitions.model.IDefinitionsService;
> import com.remainsoftware.gravity.useradmin.model.IGravityUserAdmin;
>
>
> contribute(currentType()) {
> property name : 'useradmin', type : IGravityUserAdmin, provider : 'Gravity',
> doc : 'This is the user admin service.'
> property name : 'definitions', type : IDefinitionsService, provider :
> 'Gravity', doc : 'This is the instance of the definition service.'
> }
>
>
> Note that the two imports are resolved by the editor. The dsld cannot
> compile given the following trace. If I remove the imports, the script seems
> to compile fine. What could be the problem?
>
>
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
> failed:
> Gravity.dsld: 4: unable to resolve class
> com.remainsoftware.gravity.useradmin.model.IGravityUserAdmin
>  @ line 4, column 51.
>    tware.gravity.useradmin.model.IGravityUs
>                                  ^
>
> Gravity.dsld: 3: unable to resolve class
> com.remainsoftware.gravity.definitions.model.IDefinitionsService
>  @ line 3, column 53.
>    are.gravity.definitions.model.IDefinitio
>                                  ^
>
> 2 errors
>
> at
> org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:306)
> at
> org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:949)
> at
> org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:596)
> at
> org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:545)

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Beginner problem

Andrew Eisenberg
Here's the full link:
http://docs.codehaus.org/display/GROOVY/DSL+Descriptors+for+Groovy-Eclipse#DSLDescriptorsforGroovy-Eclipse-Otherpointcuts

On Thu, Mar 22, 2012 at 11:41 AM, Andrew Eisenberg <[hidden email]> wrote:

> You must quote the references to the classes.  The DSLD file is
> resolved using a different classpath from your actual project.  This
> is because DSLD scripts are classloaded by Eclipse.  It would be
> unsafe to add the project you are editing to the classpath of your
> running Eclipse instance.
>
> So, when types defined in your project need to be referenced, they
> need to be done as Strings.
>
> The DSLD classpath includes the groovy jars, the JDK, and a portion of
> Eclipse.  Unfortunately, the confusing part is that the editor
> resolves the DSLD using the classpath of the project.  You can read
> more about it on the documentation:
> http://docs.codehaus.org/display/GROOVY/DSL+Descriptors+for+Groovy-Eclipse
>
> Currently, I don't seem to have access to that page, so I can't
> provide a better link for you that will take you to the location where
> this is actually explained, but it is in an info box somewhere in the
> middle of the document.
>
> Let me know if this fixes your problem.
>
> On Thu, Mar 22, 2012 at 11:11 AM, Wim Jongman <[hidden email]> wrote:
>> Hi,
>>
>> I am a little embarrassed to ask this since I am only started with groovy
>> dsl recently but there is this thing with the eclipse dsld that I don't
>> understand.
>>
>> I am creating an eclipse plug-in for our dsl and I have added the following
>> dsld to inject some classes in the script as per the instructions on the
>> web.
>>
>> file: Gravity.dsld
>>
>> package dsld
>>
>> import com.remainsoftware.gravity.definitions.model.IDefinitionsService;
>> import com.remainsoftware.gravity.useradmin.model.IGravityUserAdmin;
>>
>>
>> contribute(currentType()) {
>> property name : 'useradmin', type : IGravityUserAdmin, provider : 'Gravity',
>> doc : 'This is the user admin service.'
>> property name : 'definitions', type : IDefinitionsService, provider :
>> 'Gravity', doc : 'This is the instance of the definition service.'
>> }
>>
>>
>> Note that the two imports are resolved by the editor. The dsld cannot
>> compile given the following trace. If I remove the imports, the script seems
>> to compile fine. What could be the problem?
>>
>>
>> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
>> failed:
>> Gravity.dsld: 4: unable to resolve class
>> com.remainsoftware.gravity.useradmin.model.IGravityUserAdmin
>>  @ line 4, column 51.
>>    tware.gravity.useradmin.model.IGravityUs
>>                                  ^
>>
>> Gravity.dsld: 3: unable to resolve class
>> com.remainsoftware.gravity.definitions.model.IDefinitionsService
>>  @ line 3, column 53.
>>    are.gravity.definitions.model.IDefinitio
>>                                  ^
>>
>> 2 errors
>>
>> at
>> org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:306)
>> at
>> org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:949)
>> at
>> org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:596)
>> at
>> org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:545)

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Beginner problem

Wim Jongman
Got it! Thank you.

Best regards,

Wim Jongman


Reply | Threaded
Open this post in threaded view
|

Re: Beginner problem

Andrew Eisenberg
In reply to this post by Andrew Eisenberg
Here's the full link:
http://docs.codehaus.org/display/GROOVY/DSL+Descriptors+for+Groovy-Eclipse#DSLDescriptorsforGroovy-Eclipse-Otherpointcuts

On Thu, Mar 22, 2012 at 11:41 AM, Andrew Eisenberg <[hidden email]> wrote:

> You must quote the references to the classes.  The DSLD file is
> resolved using a different classpath from your actual project.  This
> is because DSLD scripts are classloaded by Eclipse.  It would be
> unsafe to add the project you are editing to the classpath of your
> running Eclipse instance.
>
> So, when types defined in your project need to be referenced, they
> need to be done as Strings.
>
> The DSLD classpath includes the groovy jars, the JDK, and a portion of
> Eclipse.  Unfortunately, the confusing part is that the editor
> resolves the DSLD using the classpath of the project.  You can read
> more about it on the documentation:
> http://docs.codehaus.org/display/GROOVY/DSL+Descriptors+for+Groovy-Eclipse
>
> Currently, I don't seem to have access to that page, so I can't
> provide a better link for you that will take you to the location where
> this is actually explained, but it is in an info box somewhere in the
> middle of the document.
>
> Let me know if this fixes your problem.
>
> On Thu, Mar 22, 2012 at 11:11 AM, Wim Jongman <[hidden email]> wrote:
>> Hi,
>>
>> I am a little embarrassed to ask this since I am only started with groovy
>> dsl recently but there is this thing with the eclipse dsld that I don't
>> understand.
>>
>> I am creating an eclipse plug-in for our dsl and I have added the following
>> dsld to inject some classes in the script as per the instructions on the
>> web.
>>
>> file: Gravity.dsld
>>
>> package dsld
>>
>> import com.remainsoftware.gravity.definitions.model.IDefinitionsService;
>> import com.remainsoftware.gravity.useradmin.model.IGravityUserAdmin;
>>
>>
>> contribute(currentType()) {
>> property name : 'useradmin', type : IGravityUserAdmin, provider : 'Gravity',
>> doc : 'This is the user admin service.'
>> property name : 'definitions', type : IDefinitionsService, provider :
>> 'Gravity', doc : 'This is the instance of the definition service.'
>> }
>>
>>
>> Note that the two imports are resolved by the editor. The dsld cannot
>> compile given the following trace. If I remove the imports, the script seems
>> to compile fine. What could be the problem?
>>
>>
>> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
>> failed:
>> Gravity.dsld: 4: unable to resolve class
>> com.remainsoftware.gravity.useradmin.model.IGravityUserAdmin
>>  @ line 4, column 51.
>>    tware.gravity.useradmin.model.IGravityUs
>>                                  ^
>>
>> Gravity.dsld: 3: unable to resolve class
>> com.remainsoftware.gravity.definitions.model.IDefinitionsService
>>  @ line 3, column 53.
>>    are.gravity.definitions.model.IDefinitio
>>                                  ^
>>
>> 2 errors
>>
>> at
>> org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:306)
>> at
>> org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:949)
>> at
>> org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:596)
>> at
>> org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:545)

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

    http://xircles.codehaus.org/manage_email