fabien7474
fabien7474

Reputation: 16566

How to configure grails classpath in order to add "src/groovy" folder ( in Linux environment)?

I am currently porting my development environment from Windows to Linux.

Under Linux, I noticed a "No class found" compilation error related to my classes in the directory <PROJECT_HOME>/src/groovy. Under windows, it works fine.

Is this "src/groovy" directory included in the CLASSPATH when running "grails run-app" ? Why does it behave differently under Windows and under Linux? (GRAILS_HOME and GROOVY_HOME are defined in both environments)

Is there a way to display the current CLASSPATH in the logs?

And most important, how do I solve my problem? (except by setting the global CLASSPATH=<PROJECT_HOME>/src/groovy)

Thank you for your help,

Regards,

Fabien.

Upvotes: 2

Views: 11851

Answers (3)

Victor Sergienko
Victor Sergienko

Reputation: 13495

CLASSPATH is not for sources but for compiled, binary classes. You need to set up your project and not Grails.

You can examine Grails environment from grails console - for instance, evaluate System.getProperty("java.class.path"). Does Console run at all?

It might be an issue with your folder structure or permissions - can you check src/groovy owner and rights, it might be owned by another user?

Upvotes: 0

Colin Harrington
Colin Harrington

Reputation: 4459

Does the code still work after you do a grails clean on Windows?

I wonder if you have refactored and have an old version still kicking around in your classes directory. Otherwise verify the case of the .class files with what you expect (as John W. suggested).

Keep in mind that Linux file systems are typically case-sensitive where Windows is not (by defauly anyway).

Could you post the exception that you are seeing?

Upvotes: 0

John Wagenleitner
John Wagenleitner

Reputation: 11035

Yes, src/groovy and src/java are automatically in the classpath when using the grails commands. I would recommend making sure your package statements are correct and that the error isn't referring to something your code is referencing.

Upvotes: 3

Related Questions