Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 356016 - honour settings <mirror/> configurations
Summary: honour settings <mirror/> configurations
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Tycho (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Tobias Oberlies CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 376981
Blocks:
  Show dependency tree
 
Reported: 2011-08-28 03:07 EDT by Igor Fedorenko CLA
Modified: 2021-04-28 16:55 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Igor Fedorenko CLA 2011-08-28 03:07:53 EDT
tycho target platform resolver should honour mirrors of p2 repositories configured in settings.xml. Make sure this is the case both for implicit target platform specification (i.e. bunch of <repository/> elements with layout=p2 in pom.xml file) and explicit target platform specification (i.e. .target file).
Comment 1 Tobias Oberlies CLA 2011-08-30 07:51:22 EDT
Sorry, we broke this when introducing the new TargetDefinitionResolver. The problem was that the logic wasn't isolated but weaved with the resolution logic. To do this properly, Tycho would need its own implementation of MetadataRepositoryManager and ArtifactRepositoryManager which honour the mirror configuration settings. With this in place, the settings could be honoured anywhere, and it would no longer necessary to repeat the mirror logic wherever repositories are loaded.

IIRC the *RepositoryManagers don't have an "id" argument, so we probably need to use URIs to look up the mirrors. IMHO this should be okay. Otherwise, we could extend the p2 interface by this parameter. If you provide a quality patch, I would be willing to include it into p2 :-)
Comment 2 Tobias Oberlies CLA 2011-09-07 05:35:44 EDT
Postponing to 0.14.0
Comment 3 Michael Vorburger CLA 2012-02-23 07:58:03 EST
+1... it would be nice to have this...
Comment 4 Michael Vorburger CLA 2012-02-23 08:15:25 EST
Actually this appears to work?  As per http://www.iulidragos.org/?p=207, using something like works just fine - I just tried it and it appears to work:

      <mirror>
         <id>p2</id>
         <name>...</name>
	 <url>http://p2.company.com/dependencies/7.0</url>
         <mirrorOf>*</mirrorOf>
	 <mirrorOfLayouts>p2</mirrorOfLayouts>
      </mirror>
Comment 5 Benjamin Schwertfeger CLA 2012-04-10 09:18:14 EDT
As long as I enter the repository explicit in the pom.xml, it is possible to set a mirror in the settings.xml which works at most. If I add http://reserve.itemis.de/eclipse/releases/indigo as an explicit repository instead of .target with selected Features, I have to increase the heap space.

Using the asterisk for mirrorOf and only .target definition without repositories inside the pom.xml, does not work. I looked at TCP/IP connections and got none to my mirror and many to eclipse.org in this case.

The mirror seems to have no effect for children of a composite, because http://download.eclipse.org/technology/epp/packages/indigo/ is set as an absolute URL in http://download.eclipse.org/releases/indigo/compositeContent.jar. Even if I enter this site as a repository and mirror it, the original repository is retrieved.
Comment 6 Igor Fedorenko CLA 2012-04-10 09:35:43 EDT
Did I mention we welcome quality patches? ;-)
Comment 7 Tobias Oberlies CLA 2012-04-19 11:11:39 EDT
The foundation for implementing this consistently has (finally) been laid with the introduction of a dedicated p2 agent for all remote operations. In this agent, it should be easily possible to intercept all repository loading calls, and redirect them according to the mirrors setting. This also automatically covers children of composite repositories.

And in case someone really considers contributing a patch: the right place to pass parameters from the Maven settings.xml to Tycho's OSGi runtime is the MavenContextImpl instance.
Comment 8 Tobias Oberlies CLA 2012-06-05 11:25:16 EDT
This should now [1] work for all repositories with explicitly configured IDs, i.e. both repositories with layout p2 in the POM and target files with (non-standard) id attributes (see [2] for an example).

I'll still need to check what happens if no ID is specified (which should be the most common case for target files because maintaining an ID is not really convenient). Related to bug 377086.

[1] http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/commit/?id=34e1a8165876829ac2d8fe4548b4a660fea85467
[2] http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/tree/tycho-its/projects/target.httpAuthentication/platform.target
Comment 9 Tobias Oberlies CLA 2012-06-07 09:15:05 EDT
This change [1] completes this feature: Whenever there is no explicitly configured ID, mirrors for p2 repositories are  looked up in the settings.xml using the URL (without trailing slashes) as ID.

[1] https://git.eclipse.org/r/6289
Comment 10 Tobias Oberlies CLA 2012-06-08 04:58:05 EDT
Added documentation for <mirror> configuration: http://wiki.eclipse.org/Tycho/Target_Platform/Authorization_and_Mirrors