Sylwester Lachiewicz created FELIX-6876:
-------------------------------------------

             Summary: Remote OBR goals depend on maven-compat WagonManager and 
on the wagons Maven bundles
                 Key: FELIX-6876
                 URL: https://issues.apache.org/jira/browse/FELIX-6876
             Project: Felix
          Issue Type: Improvement
          Components: Maven Bundle Plugin
            Reporter: Sylwester Lachiewicz


The remote OBR goals ({{bundle:deploy}} with {{remoteOBR}} set, 
{{bundle:deploy-file}}, {{bundle:remote-clean}}) reach the remote repository 
through {{RemoteFileManager}}, which uses the Maven 2 
{{org.apache.maven.artifact.manager.WagonManager}} from {{maven-compat}}:

* {{WagonManager.getWagon(repository)}} picks the provider for the URL's 
protocol,
* {{WagonManager.getAuthenticationInfo(id)}} supplies the credentials of the 
matching {{<server>}},
* then {{get}}/{{put}} download {{repository.xml}}, merge it, and upload it 
with a {{.lock}} file.

Two problems follow:

# {{maven-compat}} is the deprecated Maven 2 compatibility layer (see 
FELIX-6606); Maven 3.9 warns about it and Maven 4 keeps it only as a 
compatibility module.
# The plugin declares no Wagon provider, so {{file:}} and {{http(s):}} OBRs 
work only because Maven ships {{wagon-file}} and {{wagon-http}} in {{lib/}}. 
Removing those from the distribution is under discussion. With a Maven 3.9.16 
copy without them, the OBR goals fail with "Unsupported protocol: 'file': 
Cannot find wagon which supports the requested protocol: file" (and the same 
for {{http}}).

Default builds are not affected: {{bundle:deploy}} returns early unless 
{{remoteOBR}} is set.

Proposed fix:
* look up the Wagon by protocol from the plugin's own container instead of 
{{WagonManager}},
* take credentials from the settings {{<server>}} through 
{{SettingsDecrypter}}, and the proxy from the active settings proxy, as today,
* declare {{wagon-file}} and {{wagon-http}} so {{file:}} and {{http(s):}} OBRs 
work from the plugin realm; other protocols keep coming from build extensions,
* keep {{maven-compat}} for now: the OBR goals no longer use it, but 
{{BundlePlugin}}, {{BundleAllPlugin}} and {{AbstractBaselinePlugin}} still need 
its {{ArtifactResolver}}, {{ArtifactCollector}} and {{MavenProjectBuilder}} 
(FELIX-6606).

A pull request will follow.




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to