Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 357357

Summary: tycho tries to download p2.index files although in offline mode
Product: z_Archived Reporter: Jan Sievers <jan.sievers>
Component: TychoAssignee: Jan Sievers <jan.sievers>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
stripped down demo project none

Description Jan Sievers CLA 2011-09-12 05:44:20 EDT
Created attachment 203137 [details]
stripped down demo project

When in maven offline mode (commandline option "--offline"), tycho still tries to download p2.index files from configured p2 repositori(es). See attached demo project.

Actually in the case of composite repos like helios, we have one HTTP GET request per child repo, which can introduce a significant lag.

E.g. when using the helios p2 repo we have 8 child repos which can sum up to ~4 sec lag (with a typical HTTP roundtrip time of ~0,5 sec from Europe).
Comment 1 Jan Sievers CLA 2011-09-12 07:19:48 EDT
The root of the problem is in 

org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager#loadIndexFile(URI location, IProgressMonitor monitor)

which directly uses org.eclipse.equinox.internal.p2.repository.Transport to download the p2.index file (not using org.eclipse.equinox.internal.p2.repository.CacheManager ).

At the same time the CacheManager API 

File createCache(URI repositoryLocation, String prefix, IProgressMonitor monitor) 

was not designed to cache anything else but a file prefix plus a hardcoded ".xml" or ".jar" suffix so it's currently impossible to use the cache for the p2.index file.

Rather than trying to change the whole cache logic in p2 I revert to the pragmatic approach of registering an "OfflineTransport" service implementation  with the p2 agent used in tycho. This basically does nothing when in offline mode.