Script Folder Support does not work for me as expected

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

Script Folder Support does not work for me as expected

k7sleeper

Hi

I've a problem with Script Folder Support (KEPLER, GRECLIPSE 4.3).

My project contains Groovy classes in

src/main/groovy

and Groovy scripts in

src/main/scripts

I've enabled Script Folder Support for the project and enabled the script folder pattern src/main/scripts/**/*.groovy

The problem now is that I've two scripts which both define a class Globals. As ths scripts are independend from each other that's no problem, but after building the project, Ecplise shows the error "The type Globals is already defined".

If I remove folder src/main/scripts from the source folders I don't get this error, but I also never get an error which is not that what I want.

Is it possible to have scripts in a script folder which are independent from each other, and which are not compiled to the target folder but which are syntax checked, for which code completion works, and which can be debugged?

Thanks for help,

Klaus

Reply | Threaded
Open this post in threaded view
|

Re: Script Folder Support does not work for me as expected

Thomas Modeneis
Do you mean the compiled classes are in src/main/groovy and the .groovy are in src/main/scripts ?
Correct me if I'm wrong, cuz That's quite strange approach. 



On Mon, Aug 19, 2013 at 11:16 AM, Klaus Sevensleeper <[hidden email]> wrote:

Hi

I've a problem with Script Folder Support (KEPLER, GRECLIPSE 4.3).

My project contains Groovy classes in

src/main/groovy

and Groovy scripts in

src/main/scripts

I've enabled Script Folder Support for the project and enabled the script folder pattern src/main/scripts/**/*.groovy

The problem now is that I've two scripts which both define a class Globals. As ths scripts are independend from each other that's no problem, but after building the project, Ecplise shows the error "The type Globals is already defined".

If I remove folder src/main/scripts from the source folders I don't get this error, but I also never get an error which is not that what I want.

Is it possible to have scripts in a script folder which are independent from each other, and which are not compiled to the target folder but which are syntax checked, for which code completion works, and which can be debugged?

Thanks for help,

Klaus


Reply | Threaded
Open this post in threaded view
|

Re: Script Folder Support does not work for me as expected

k7sleeper
This post was updated on .
.groovy files are at both locations but the .groovy files from src/main/groovy
should be compiled and the .groovy files from src/main/scripts should NOT
be compiled but copied to the target folder. I also need syntax check, code
completion ... for the .groovy files from src/main/scripts.
Reply | Threaded
Open this post in threaded view
|

Re: Script Folder Support does not work for me as expected

Thomas Modeneis
right so you should not have them inside the src folder, this are for source folders.
If you want to have the compiled folders on target, you better start having a look at maven.



On Mon, Aug 19, 2013 at 1:22 PM, Klaus Sevensleeper <[hidden email]> wrote:
.groovy files are at both locations but the .groovy files from src/main/groovy should be compiled and the .groovy files from src/main/scripts should NOT be compiled but copied to the target folder. I also need syntax check, code completion ... for the .groovy files from src/main/scripts.


2013/8/19 Thomas Modeneis <[hidden email]>
Do you mean the compiled classes are in src/main/groovy and the .groovy are in src/main/scripts ?
Correct me if I'm wrong, cuz That's quite strange approach. 



On Mon, Aug 19, 2013 at 11:16 AM, Klaus Sevensleeper <[hidden email]> wrote:

Hi

I've a problem with Script Folder Support (KEPLER, GRECLIPSE 4.3).

My project contains Groovy classes in

src/main/groovy

and Groovy scripts in

src/main/scripts

I've enabled Script Folder Support for the project and enabled the script folder pattern src/main/scripts/**/*.groovy

The problem now is that I've two scripts which both define a class Globals. As ths scripts are independend from each other that's no problem, but after building the project, Ecplise shows the error "The type Globals is already defined".

If I remove folder src/main/scripts from the source folders I don't get this error, but I also never get an error which is not that what I want.

Is it possible to have scripts in a script folder which are independent from each other, and which are not compiled to the target folder but which are syntax checked, for which code completion works, and which can be debugged?

Thanks for help,

Klaus




Reply | Threaded
Open this post in threaded view
|

Re: Script Folder Support does not work for me as expected

k7sleeper
This post was updated on .
I think I do not understand your answer.

I try to pose my question again:

If I have an arbitrary folder with .groovy files which are independent from
each other (i.e. contain classes with the same name etc.), is Eclipse with
Groovy Support the right/an appropriate IDE to edit + debug these scripts?
Reply | Threaded
Open this post in threaded view
|

Re: Script Folder Support does not work for me as expected

Thomas Modeneis
The answer is: You should not have two files with the same name and in the same package structure, that is wrong.




On Mon, Aug 19, 2013 at 1:45 PM, Klaus Sevensleeper <[hidden email]> wrote:
I think do not understand your answer.

I try to pose my question again:

If I have an arbitrary folder with .groovy files which are independent from each other (i.e. contain classes with the same name etc.), is Eclipse with Groovy Support the right/an appropriate IDE to edit + debug these scripts?


2013/8/19 Thomas Modeneis <[hidden email]>
right so you should not have them inside the src folder, this are for source folders.
If you want to have the compiled folders on target, you better start having a look at maven.



On Mon, Aug 19, 2013 at 1:22 PM, Klaus Sevensleeper <[hidden email]> wrote:
.groovy files are at both locations but the .groovy files from src/main/groovy should be compiled and the .groovy files from src/main/scripts should NOT be compiled but copied to the target folder. I also need syntax check, code completion ... for the .groovy files from src/main/scripts.


2013/8/19 Thomas Modeneis <[hidden email]>
Do you mean the compiled classes are in src/main/groovy and the .groovy are in src/main/scripts ?
Correct me if I'm wrong, cuz That's quite strange approach. 



On Mon, Aug 19, 2013 at 11:16 AM, Klaus Sevensleeper <[hidden email]> wrote:

Hi

I've a problem with Script Folder Support (KEPLER, GRECLIPSE 4.3).

My project contains Groovy classes in

src/main/groovy

and Groovy scripts in

src/main/scripts

I've enabled Script Folder Support for the project and enabled the script folder pattern src/main/scripts/**/*.groovy

The problem now is that I've two scripts which both define a class Globals. As ths scripts are independend from each other that's no problem, but after building the project, Ecplise shows the error "The type Globals is already defined".

If I remove folder src/main/scripts from the source folders I don't get this error, but I also never get an error which is not that what I want.

Is it possible to have scripts in a script folder which are independent from each other, and which are not compiled to the target folder but which are syntax checked, for which code completion works, and which can be debugged?

Thanks for help,

Klaus






Reply | Threaded
Open this post in threaded view
|

Re: Script Folder Support does not work for me as expected

k7sleeper
This post was updated on .
Well, I do not have two files with the same name in the same package
structure.

I have a.groovy and b.groovy in the same folder. In a.groovy beside the
script code there are some class definitions and also in b.groovy. The
problem is that in both files I have a class definition Constants and
Globals. That's no problem when I run a.groovy or b.groovy from command
line, but if I edit these files with Eclipse I get "duplicate class" error
:-(

Obviously, Eclipse compiles all files from that folder although it's marked
as a script folder. That's strange for me ...


2013/8/19 Thomas Modeneis <thomas.modeneis@gmail.com>

> The answer is: You should not have two files with the same name and in
> the same package structure, that is wrong.
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Script Folder Support does not work for me as expected

Andrew Eisenberg
Hi Klaus,

The only way that I am aware of being able to avoid the error in Eclipse is if you either:

1. rename the class definitions in your scripts
2. add package declarations to your scripts (you may have to also move to the appropriate folder, not sure).
3. remove src/main/scripts as a source folder

Eclipse is not compiling the scripts.  Rather it is trying to do some checking and semantic analysis on the scripts (which really is about 80% of a compile, without writing out byte code to disk). It is getting confused because it is trying to resolve names to classes and it is finding multiple definitions.  At this point, there is no perfect solution.


On Mon, Aug 19, 2013 at 5:30 AM, Klaus Sevensleeper <[hidden email]> wrote:
Well, I do not have two files with the same name in the same package structure.

I have a.groovy and b.groovy in the same folder. In a.groovy beside the script code there are some class definitions and also in b.groovy. The problem is that in both files I have a class definition Constants and Globals. That's no problem when I run a.groovy or b.groovy from command line, but if I edit these files with Eclipse I get "duplicate class" error :-(

Obviously, Eclipse compiles all files from that folder although it's marked as a script folder. That's strange for me ...


2013/8/19 Thomas Modeneis <[hidden email]>
The answer is: You should not have two files with the same name and in the same package structure, that is wrong.




On Mon, Aug 19, 2013 at 1:45 PM, Klaus Sevensleeper <[hidden email]> wrote:
I think do not understand your answer.

I try to pose my question again:

If I have an arbitrary folder with .groovy files which are independent from each other (i.e. contain classes with the same name etc.), is Eclipse with Groovy Support the right/an appropriate IDE to edit + debug these scripts?


2013/8/19 Thomas Modeneis <[hidden email]>
right so you should not have them inside the src folder, this are for source folders.
If you want to have the compiled folders on target, you better start having a look at maven.



On Mon, Aug 19, 2013 at 1:22 PM, Klaus Sevensleeper <[hidden email]> wrote:
.groovy files are at both locations but the .groovy files from src/main/groovy should be compiled and the .groovy files from src/main/scripts should NOT be compiled but copied to the target folder. I also need syntax check, code completion ... for the .groovy files from src/main/scripts.


2013/8/19 Thomas Modeneis <[hidden email]>
Do you mean the compiled classes are in src/main/groovy and the .groovy are in src/main/scripts ?
Correct me if I'm wrong, cuz That's quite strange approach. 



On Mon, Aug 19, 2013 at 11:16 AM, Klaus Sevensleeper <[hidden email]> wrote:

Hi

I've a problem with Script Folder Support (KEPLER, GRECLIPSE 4.3).

My project contains Groovy classes in

src/main/groovy

and Groovy scripts in

src/main/scripts

I've enabled Script Folder Support for the project and enabled the script folder pattern src/main/scripts/**/*.groovy

The problem now is that I've two scripts which both define a class Globals. As ths scripts are independend from each other that's no problem, but after building the project, Ecplise shows the error "The type Globals is already defined".

If I remove folder src/main/scripts from the source folders I don't get this error, but I also never get an error which is not that what I want.

Is it possible to have scripts in a script folder which are independent from each other, and which are not compiled to the target folder but which are syntax checked, for which code completion works, and which can be debugged?

Thanks for help,

Klaus








Reply | Threaded
Open this post in threaded view
|

Re: Script Folder Support does not work for me as expected

k7sleeper
Thank you, Andrew,

you confirmed what I guessed.

Thanks again for your detailed and clear answer!

Klaus


2013/8/20 Andrew Eisenberg <[hidden email]>
Hi Klaus,

The only way that I am aware of being able to avoid the error in Eclipse is if you either:

1. rename the class definitions in your scripts
2. add package declarations to your scripts (you may have to also move to the appropriate folder, not sure).
3. remove src/main/scripts as a source folder

Eclipse is not compiling the scripts.  Rather it is trying to do some checking and semantic analysis on the scripts (which really is about 80% of a compile, without writing out byte code to disk). It is getting confused because it is trying to resolve names to classes and it is finding multiple definitions.  At this point, there is no perfect solution.


On Mon, Aug 19, 2013 at 5:30 AM, Klaus Sevensleeper <[hidden email]> wrote:
Well, I do not have two files with the same name in the same package structure.

I have a.groovy and b.groovy in the same folder. In a.groovy beside the script code there are some class definitions and also in b.groovy. The problem is that in both files I have a class definition Constants and Globals. That's no problem when I run a.groovy or b.groovy from command line, but if I edit these files with Eclipse I get "duplicate class" error :-(

Obviously, Eclipse compiles all files from that folder although it's marked as a script folder. That's strange for me ...


2013/8/19 Thomas Modeneis <[hidden email]>
The answer is: You should not have two files with the same name and in the same package structure, that is wrong.




On Mon, Aug 19, 2013 at 1:45 PM, Klaus Sevensleeper <[hidden email]> wrote:
I think do not understand your answer.

I try to pose my question again:

If I have an arbitrary folder with .groovy files which are independent from each other (i.e. contain classes with the same name etc.), is Eclipse with Groovy Support the right/an appropriate IDE to edit + debug these scripts?


2013/8/19 Thomas Modeneis <[hidden email]>
right so you should not have them inside the src folder, this are for source folders.
If you want to have the compiled folders on target, you better start having a look at maven.



On Mon, Aug 19, 2013 at 1:22 PM, Klaus Sevensleeper <[hidden email]> wrote:
.groovy files are at both locations but the .groovy files from src/main/groovy should be compiled and the .groovy files from src/main/scripts should NOT be compiled but copied to the target folder. I also need syntax check, code completion ... for the .groovy files from src/main/scripts.


2013/8/19 Thomas Modeneis <[hidden email]>
Do you mean the compiled classes are in src/main/groovy and the .groovy are in src/main/scripts ?
Correct me if I'm wrong, cuz That's quite strange approach. 



On Mon, Aug 19, 2013 at 11:16 AM, Klaus Sevensleeper <[hidden email]> wrote:

Hi

I've a problem with Script Folder Support (KEPLER, GRECLIPSE 4.3).

My project contains Groovy classes in

src/main/groovy

and Groovy scripts in

src/main/scripts

I've enabled Script Folder Support for the project and enabled the script folder pattern src/main/scripts/**/*.groovy

The problem now is that I've two scripts which both define a class Globals. As ths scripts are independend from each other that's no problem, but after building the project, Ecplise shows the error "The type Globals is already defined".

If I remove folder src/main/scripts from the source folders I don't get this error, but I also never get an error which is not that what I want.

Is it possible to have scripts in a script folder which are independent from each other, and which are not compiled to the target folder but which are syntax checked, for which code completion works, and which can be debugged?

Thanks for help,

Klaus