Gradle not building if there's no network connection

View: New views
4 Messages — Rating Filter:   Alert me  

Gradle not building if there's no network connection

by Andrew Pietsch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

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

by Adam Murdoch-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



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



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

by hdockter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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



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

by Andrew Pietsch-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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.