Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to correctly add a Java Maven project dependency to a Grails Maven project in eclipse

I'm using:

  • Eclipse Kepler Service Release 2
  • M2E - Maven Integration for Eclipse 1.4.0.xxx
  • Grails 2.1.2
  • Groovy/Grails Tool Suite 3.4.0

My approach was to create a Grails application, then convert it to a Maven project and then I added a Java Maven project as dependency through the "Java Build Path" -> "Projects" option. But every time I want to run the Grails application the Grails application is unable to resolve those classes from my other Java Maven project. Might be a very simple problem but I couldn't find any solution so far.

Thank you in advance!

like image 769
user1972618 Avatar asked Dec 07 '22 02:12

user1972618


1 Answers

I think a better approach would be publishing your jar into your local repository, then you can add your dependency into your grails application by configuring BuildConfig.groovy:

1) Add your local maven repo to your project:

repositories {
    inherits true
    checksums false
    grailsPlugins()
    mavenLocal()
    mavenCentral()
    }

2) add your dependency:

dependencies {
compile: "<your_group_id> : <your_artifact_id> : <version>"
...
}

When you're launching your project in grails env, it will download automatically your jar

like image 145
ludo_rj Avatar answered Dec 08 '22 15:12

ludo_rj