5

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.

Kasturi
  • 3,335
  • 3
  • 28
  • 42

3 Answers3

2

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

Paco Zarate
  • 1,925
  • 1
  • 15
  • 13
0

The documentation includes information on customizing the build.

You can add this to your BuildConfig.groovy:

grails.compiler.dependencies = {
    fileset (dir:"/path/to/jars")
}

That should get you started.

OverZealous
  • 39,252
  • 15
  • 98
  • 100
0

If the dependencies are not stored in an Ivy/Maven repository then AFAIK your only option is to copy the dependencies to the lib directory of the Grails project.

Dónal
  • 185,044
  • 174
  • 569
  • 824
  • the dependencies are not jar files that i can add it to the lib directory. They are other projects that exist in my eclipse workspace – Kasturi Aug 04 '11 at 13:20
  • Have you tried adding the directory where those other projects' classes are stored to the CLASSPATH of the grails project? – Dónal Aug 04 '11 at 15:40