tl;dr version:
Change BuildConfig.groovy to reference your local mavenRepo repository as:
mavenRepo ("http://my.server/repos/my-grails-plugins") { updatePolicy 'always' }
Long version:
If you have played around with Grails 2.3, you know that the project has switched to Maven (Aether, actually) as default for dependency resolution, as opposed to Ivy. However, on my current project, we have run into a few issues with the semantics of dependency caching with Aether as opposed to Ivy.
In Ivy, when you updated a snapshot dependency, it would detect that and immediately go download it from the repository. Aether’s default update policy on snapshots is to update at most once per day. This doesn’t work well when a Grails plugin is under active development and you are constantly publishing new versions to your own hosted artifact repository, such as Artifactory.
The fix listed above instructs Aether to always update the dependencies in that particular repository. You can read more about it in the Grails docs.
Here are the possible values for updatePolicy:
- never – Never check for new snapshots
- always – Always check for new snapshots
- daily – Check once a day for new snapshots (the default)
- interval:x – Check once every x minutes for new snapshots
Once you set a more frequent update policy, you should see something similar in the logs when you refresh-dependencies. This lets you know that Grails is checking the repository for new artifacts:
| Downloading: org/grails/plugins/xyz/1.0-SNAPSHOT/maven-metadata.xml
| Downloading: org/grails/plugins/abc/1.0-SNAPSHOT/maven-metadata.xml
Has this option changed? I’m using grails 2.3.5 and get an error message: “There was an error loading the BuildConfig: No signature of method: groovy.util.ConfigSlurper$_parse_closure5.updatePolicy() is applicable for argument types: (java.lang.String) values: [always]” when I try this.
@stenis999 is your resolver set to maven in BuildConfig? If so, you may want to clean everything out of target and see if it clears up.