grails dependency resolution
My Grails project depends on an intenal library Commons.jar
which is built with Maven. In BuildConfig.groovy
I have configured it to look for this dependency first in the local Maven repository, then in the company-wide 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 build Common/jar (using mvn deploy
), it is stored first in mavenLocal, then copied to mavenRepo. However, when I build the Grails app, it looks for the JAR in the following locations:
- Ivy cache (defaults to ~/.ivy2/cache)
- mavenLocal (defined by $M2_REPO)
- mavenRepo (http://build.mycompany.com/wtp_repository)
So the Grails app is constantly picking up an old version of the JAR from the Ivy cache, which is never updated when the Commons project is built.
I guess I could fix this problem if I knew how to:
- Prevent Grails for looking for dependencies in the开发者_StackOverflow Ivy cache (though I guess disabling the cache might slow down my builds considerably)
- Ensure that the Ivy cache is also updated when I build Commons
However, it seems that anyone else that references SNAPSHOT artifacts of Maven projects should also have this problem, so perhaps I'm missing something?
Thanks!
I guess this discussion is related to the problem you have and possibly suggests some workaround/solution.
精彩评论