简体   繁体   中英

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.

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

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.

如果依赖项未存储在Ivy / Maven存储库中,那么AFAIK唯一的选择是将依赖项复制到Grails项目的lib目录中。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM