Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 357357 - tycho tries to download p2.index files although in offline mode
Summary: tycho tries to download p2.index files although in offline mode
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Tycho (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Jan Sievers CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-12 05:44 EDT by Jan Sievers CLA
Modified: 2021-04-28 16:55 EDT (History)
0 users

See Also:


Attachments
stripped down demo project (1.78 KB, application/zip)
2011-09-12 05:44 EDT, Jan Sievers CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.