Gradle not building if there's no network connection

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Gradle not building if there's no network connection

Andrew Pietsch
Hi there,

I noticed the other day that my build fails while trying to update snapshot dependencies if there's no network connection.  Since all the dependencies are in my cache is there anyway to make the build to continue?

Cheers
Andrew
Reply | Threaded
Open this post in threaded view
|

Re: Gradle not building if there's no network connection

Adam Murdoch-2


Andrew Pietsch wrote:
> Hi there,
>
> I noticed the other day that my build fails while trying to update
> snapshot dependencies if there's no network connection.  Since all the
> dependencies are in my cache is there anyway to make the build to
> continue?
>

No built-in way, yet. There's a JIRA issue for this:
http://jira.codehaus.org/browse/GRADLE-320

It is possible to script an 'offline' mode in your build script. Here is
an example which uses the maven central repository when online, and the
local Gradle cache when offline:

    repositories {
        if (rootProject.hasProperty('offline')) {
            add(new FileSystemResolver()) {
                name = 'gradleCache'
               
addArtifactPattern("${gradle.gradleUserHomeDir}/cache/${ResolverContainer.DEFAULT_CACHE_ARTIFACT_PATTERN}")
               
addIvyPattern("${gradle.gradleUserHomeDir}/cache/${ResolverContainer.DEFAULT_CACHE_IVY_PATTERN}")
            }
        }
        else {
            repositories { mavenCentral() }
        }
    }


--
Adam Murdoch
Gradle Developer
http://www.gradle.org


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Gradle not building if there's no network connection

hans_d
Administrator

On Nov 8, 2009, at 11:47 PM, Adam Murdoch wrote:

>
>
> Andrew Pietsch wrote:
>> Hi there,
>>
>> I noticed the other day that my build fails while trying to update  
>> snapshot dependencies if there's no network connection.  Since all  
>> the dependencies are in my cache is there anyway to make the build  
>> to continue?

This occurs when dynamic dependencies are used. For example Maven  
snapshots or something like "junit:junit:4.4+". We do this in the  
integration test. Is this where your build stalls?

- Hans

--
Hans Dockter
Gradle Project Manager
http://www.gradle.org

>>
>
> No built-in way, yet. There's a JIRA issue for this: http://jira.codehaus.org/browse/GRADLE-320
>
> It is possible to script an 'offline' mode in your build script.  
> Here is an example which uses the maven central repository when  
> online, and the local Gradle cache when offline:
>
>   repositories {
>       if (rootProject.hasProperty('offline')) {
>           add(new FileSystemResolver()) {
>               name = 'gradleCache'
>               addArtifactPattern("${gradle.gradleUserHomeDir}/cache/$
> {ResolverContainer.DEFAULT_CACHE_ARTIFACT_PATTERN}")
>               addIvyPattern("${gradle.gradleUserHomeDir}/cache/$
> {ResolverContainer.DEFAULT_CACHE_IVY_PATTERN}")
>           }
>       }
>       else {
>           repositories { mavenCentral() }
>       }
>   }
>
>
> --
> Adam Murdoch
> Gradle Developer
> http://www.gradle.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Gradle not building if there's no network connection

Andrew Pietsch-2

I noticed the other day that my build fails while trying to update snapshot dependencies if there's no network connection.  Since all the dependencies are in my cache is there anyway to make the build to continue?

This occurs when dynamic dependencies are used. For example Maven snapshots or something like "junit:junit:4.4+". We do this in the integration test. Is this where your build stalls?


Yep.