Skip to content
Advertisement

How to add Java JAR files to Grails project?

I have a few Java/Maven projects that I want to use in a Grails 2.0.4 project. I have tried various approaches, such as:

  1. Installing the JAR files in my local maven repository, and executing grails install-dependency com.foo:my-project:0.0.1-SNAPSHOT
  2. Copying the JAR files into the lib folder of grails.
  3. Adding compile com.foo:my-project:0.0.1-SNAPSHOT to the dependencies section of BuildConfig.groovy
  4. Uncommenting mavenLocal() and passing /home/me/.m2/repository

I may have tried a few other things, such as superstitiously throwing in a grails clean whenever convenient. In every case grails compile yields the following result: compilation fails, unable to resolve every reference to any of the classes in either of the JARs.

Any idea what I’m missing?

Advertisement

Answer

Putting the jar in the lib folder should do the trick. We are using the same approach currently without problems.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement