ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

How to compile a rosjava package offline?

asked 2016-02-15 03:27:25 -0500

Manuel gravatar image

Hello, I tried to compile a rosjava package without internet connection and it complained about not being able to reach "https://github.com/rosjava/rosjava_bootstrap/raw/indigo/buildscript.gradle"

FAILURE: Build failed with an exception.
* What went wrong:
> Could not read script 'https://github.com/rosjava/rosjava_bootstrap/raw/indigo/buildscript.gradle'.
> github.com

After that, I tried again with internec connection and it compiled. I would like to be able to code without internet connection. Is it possible? How? Thanks

edit retag flag offensive close merge delete

Comments

For that particular error you can work around it by either making sure that file is available locally (and updating the URL to it in your grade script), or by copy/pasting the contents of that file into your own Gradle script (essentially replacing the include. Not recommended).

gvdhoorn gravatar image gvdhoorn  ( 2016-02-15 07:04:06 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-02-23 05:09:36 -0500

Manuel gravatar image

updated 2016-02-23 05:13:42 -0500

Thanks. That gave me an idea: always try to download URL, but keep a copy just in case. In build.gradle I changed this:


buildscript { 
  apply from: "https://github.com/rosjava/rosjava_bootstrap/raw/indigo/buildscript.gradle"  
}

To this:


buildscript {
    def f = new File("buildscript.gradle") 
    try{ 
    new URL("https://github.com/rosjava/rosjava_bootstrap/raw/indigo/buildscript.gradle").withInputStream{ i -> f.withOutputStream{ it << i }}    
    } catch (all) { 
      //do nothing, keep cached script 
    }  
    apply from: "buildscript.gradle"  
}

So I keep a local copy, but if available, downloads from internet.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2016-02-15 03:27:25 -0500

Seen: 536 times

Last updated: Feb 23 '16