How to properly add Java Maven project dependency to Grails Maven project in eclipse

I use:

  • 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 the Java Maven project as a dependency through the option "Java Build Path" → "Projects". But every time I want to start the Grails application, the Grails application cannot resolve these classes from my other Java Maven project. This may be a very simple problem, but I have not yet found any solution.

Thank you in advance!

+4
source share
3 answers

I had the same problem that it was not possible to allow class changes in a separate Maven module. What worked for me:

  • Add a dependency on the pom.xml of the Grails project (so you can build outside the IDE)
  • Do not add a Maven character to your Grails project. Other projects will still be Maven, but the Grails project should not.
  • In Grails Project Properties, select Java Build Path → Projects and add other Maven projects. This allows Eclipse to immediately find changes in another project.
  • Launch Grails with JRebel enabled (so you can reload changes to Java classes in separate Maven modules)

GGTS 3.4 Grails 2.1.2 . , Maven , .

+2

, , grails, BuildConfig.groovy:

1) maven :

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

2) :

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

grails env,

+10

Maven, pom.xml "".

:

<dependencies>
        <dependency>
            <groupId>your-library-project-group</groupId>
            <artifactId>your-library-artifact-id</artifactId>
            <version>your-library-version</version>
            <scope>compile</scope>
        </dependency>
</dependencies>
+2

Source: https://habr.com/ru/post/1532986/


All Articles