Grails and Local Maven Dependencies
Solution 1
It turned out that the problem was then non empty cache for the artifact. While the activemq jar file was untouched, the acme-adapter-api.jar was in fact many times changed but without increasing the maven build id, 1.3, in the above case.
I could fix it, when I increased the build number to 1.4-SNAPSHOT...
Two question remain:
- Isn't the maven contract to always fetch SNAPSHOT versions, for the exact same reason?
- How to forcefully empty the cache? And where is it?
I will open a new question to answer part 2 here
Solution 2
Grails 1.3.6 has been updated with Ivy 2.2 (which indicated that it applied a fix for https://issues.apache.org/jira/browse/IVY-938) and I can get updates to SNAPSHOT versions if I specify "changing = true", as in:
dependencies {
runtime ('groupId:artifactId:version-SNAPSHOT') {
changing = true
}
}
Related videos on Youtube
raoulsson
Before: CTO Contovista AG, Zurich, Co-founder Zorp Technologies Inc., SF, Manager and Chief System Architect at Leonteq, and many more... Experienced software engineer and teamlead looking to build/enable useful, delightful, and meaningful products. Passionate, hard-worker interested in contributing to team-oriented, strong engineering cultures. Proven track record of hiring and running successful teams.
Updated on June 04, 2022Comments
-
raoulsson almost 2 years
I'm developing a small web frontend in Grails. It is basically a "ultra light-weight" client app that is connected async through JMS.
I have two dependencies in the project that I would like to pull from a Maven repository. They is
activemq
andacme-adapter-api
, a in-house dependency, not available at the remote repository.I set up my
BuildConfig.groovy
(Grails 1.2M4) file like this, in order to access my dependencies:repositories { grailsPlugins() grailsHome() mavenCentral() mavenRepo('D:/maven-repo') } dependencies { compile 'org.apache.activemq:apache-activemq:4.1.1' compile 'com.acme:acme-adapter-api:1.3-SNAPSHOT' }
When I run
grails dependency-report
, I can see this line concerning theacme-adapter-api
, for example:acme-adapter-api by com.acme 108 kB (0 kB downloaded, 108 kB in cache)
When I try to run
grails compile
, I don't get lucky, as it then complains it is unable to resolve the classes from thecom.acme
group.Interestingly the
activemq
dependencies don't seem to be a problem...The difference is that the acme dependencies are not in
mavenCentral()
, but only inmavenRepo("D:/maven-repo")
. So I thought: "Maybe it is not picking it up from the local disk then..." and changed the version to some funny (1.999-SNAPSHOT) value that doens't exist in theBuildConfig.groovy
file. When runninggrails compile
again, the command timed out, saying that version could not be found:UNRESOLVED DEPENDENCIES D:/maven-repo: unable to get resource for com/acme#acme-adapter-api;1.999-SNAPSHOT
So obviously the local dependency gets resolved but somehow not applied in the next step, compilation...
-
Fernando over 14 yearsI just ran into the same problem. The SNAPSHOT dependencies are not reloaded after the first time. This is a huge issue during development. :/ Grrr.