Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails refresh-dependencies doesn't download snapshot dependency from local maven repository

I am using Grails 2.1.1 and Maven 3.0.3.

In my buildConfig.groovy, I have pom true and I generated the pom.xml via grails create-pom. In this pom I have a dependency with <version>1.0-SNAPSHOT</version> which exists only in my local maven repository. I can successfully run mvn clean compile on this pom.

However running grails refresh-dependencies does not download the most recent version of my snapshot dependency from my local maven repository. The only way I can get it to download the latest version is to manually delete it from the ivy cache.

According to the documentation:

All dependencies (jars and plugins) with a version number ending in -SNAPSHOT are implicitly considered to be changing by Grails.

I assume it would recognize my snapshot file as changing and download it when it is modified. Am I missing some other configuration step? I only want to use maven for dependency management, but is this entirely the wrong way to use Maven with Grails?

like image 293
beldenge Avatar asked Nov 02 '12 07:11

beldenge


1 Answers

This is actually the normal behavior of the Aether resolver.

--refresh-dependencies doesn't bypass your local maven cache. To do that, you'll need to set the maven repository that contains your dependency to always download new snapshots. In BuildConfig.groovy's repositories block:

mavenRepo ("http://my.server/repos/my-grails-plugins") {
    updatePolicy 'always'
}

Credit to http://asoftwareguy.com/2013/10/25/grails-2-3-maven-dependency-caching-issues/.

like image 65
jonnybot Avatar answered Oct 20 '22 00:10

jonnybot