Hi,

On 29.08.2011, at 23:25, Nicolas Lalevée wrote:

>> 1. Is it supported to copy/mirror an Eclipse P2 repository into a local Ivy 
>> repository?
> 
> I have successfully made Ivy read a Eclipse P2 repository in order to 
> download its jars, like any other jar repository, but nothing more. The 
> pieces should be there to do the complete copy chain though.

I'm quite unexperienced with Ivy's Java APIs. Thus, may anybody confirm that 
this solution is the way to go?

So far, I've create a repository descriptor from an upate-site URL, saved the 
ivy descriptor to disc (not really needed I guess), and manually downloaded the 
jar file to local disc:

RepoDescriptor repo = loadRepositoryDescriptor(url).get();

for (final ModuleDescriptor module : (Set<ModuleDescriptor>){
  // save the ivy descriptor of the osgi bundle:
  File ivyFile = File.createTempFile(module.getModuleRevisionId().getName() + 
"_tmp_", ".xml");
  module.toIvyFile(ivyFile);

  // download each artifact:
  for (final Artifact artifact : module.getAllArtifacts()) {

    // the url returned by the artifact always starts with "file:http://";, is 
this ok?
    URL artifactUrl = new 
URL(artifact.getUrl().toExternalForm().replace("file:", ""));
    File createTempFile = File.createTempFile("temp", ".jar");

    // download the jar to local disc
    FileUtil.copy(artifactUrl, createTempFile, new CopyProgressListener() { ... 
}

    // install somehow into a local ivy repository. How is this done?
    // Are there any code examples? Which Method is relevant for doing this?


Thanks,
Marcel

-- 
Eclipse Code Recommenders:
 w www.eclipse.org/recommenders
 tw www.twitter.com/marcelbruch
 g+ www.gplus.to/marcelbruch

Reply via email to