Grails dependency resolution

My Grails project depends on the intenal Commons.jar library, which is built using Maven. In BuildConfig.groovy I configured it to search for this dependency first in the local Maven repository, and then in the entire company repository.

 repositories { // Read the location of the local Maven repository from $M2_REPO mavenLocal System.getenv("M2_REPO") mavenRepo "http://build.mycompany.com/wtp_repository" } plugins { build 'org.grails.plugins:spring-security-core:1.0.1' } dependencies { compile ('com.mycompany:Commons:1.0.0-SNAPSHOT') } 

When I create Common / jar (using mvn deploy ), it is first saved to mavenLocal and then copied to mavenRepo. However, when I create the Grails application, it searches for JARs in the following places:

  • Ivy Cache (default is ~ / .ivy2 / cache)
  • mavenLocal (defined by $ M2_REPO)
  • mavenRepo (http://build.mycompany.com/wtp_repository)

In this way, the Grails app constantly builds an old version of the JAR from the Ivy cache, which is never updated when the Commons project is created.

I think I could fix this problem if I knew how:

  • Prevent using Grails to look for dependencies in the Ivy cache (although I think disabling the cache can slow down my builds significantly)
  • Make sure Ivy cache is also updated when I create Commons

However, it seems like anyone else that references SNAPSHOT artifacts from Maven projects should also have this problem, maybe I'm missing something?

Thanks!

+4
source share
1 answer

I think this discussion is related to the problem you have, and perhaps offers some workaround / solution.

+2
source

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


All Articles