Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails Project - Common Java Project Dependency in Eclipse

All,

We have standard java projects that contain our common data model, common util classes, etc...

What I can’t seem to figure out is how, to make my Grails project (in Eclipse) have a dependency on the other standard (non Grails) java project in the workspace. When I add the project in the “Java Build Path” the project doesn’t show any compiler errors, but it when I run “Grails Tools -> Refresh Dependencies” or attempt to run the project (run-app) it fails.

This seems like it would be a pretty common thing, but I have searched all over the web and have been unable to find a solution. We are not using maven in our environment. Since we build Eclipse RCP applications on the client side, we use OSGI manifests to manage our project / bundle dependencies.

like image 603
Kasturi Avatar asked Nov 04 '22 17:11

Kasturi


1 Answers

You can use linked source directories to include the Java or Groovy dependencies in the grails project and you need to set the output directory to Project/target/classes (these configurations go into the grails project preferences in Java Build Path options -> Source Tab).

The change in the output directory allows Eclipse to detect changes in the dependencies and auto load it when running the app using grails run-app.

You can use autocomplete and debug the sources of the dependencies with this configuration.

I prepared a step and step process that includes screenshots for Java and Groovy here

like image 117
Paco Zarate Avatar answered Nov 09 '22 09:11

Paco Zarate