[ 
https://issues.apache.org/jira/browse/KARAF-4288?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stuart McCulloch updated KARAF-4288:
------------------------------------
    Description: 
When adding features to a custom distribution karaf-maven-plugin uses 
pax-url-aether to fetch artifacts which don't yet exist in the local maven 
repository.

pax-url-aether has logic to discover the local repository and settings.xml 
file, but this relies on defaults plus a few heuristics. If a Maven build uses 
a custom settings.xml file which contains auth details, ie. when running on CI, 
then this is not picked up by pax-url-aether and it cannot fetch down 
additional content.

The current user settings file is accessible from the MavenSession which is 
already available in Karaf's MojoSupport:

   MavenSession->getRequest->getUserSettingsFile

All that needs to be done is to pass this path to pax-url-aether by setting the 
"org.ops4j.pax.url.mvn.settings" system property. (Note the custom user 
settings file may be null or may not exist, in which case pax-url-aether should 
use the global settings - since it already has code to discover this using 
known locations we don't need to pass the global value, so we just avoid 
setting "org.ops4j.pax.url.mvn.settings" in this case)

(I'll attach a patch that implements this suggested solution)

  was:
When adding features to a custom distribution karaf-maven-plugin uses 
pax-url-aether to fetch artifacts which don't yet exist in the local maven 
repository.

pax-url-aether has logic to discover the local repository and settings.xml 
file, but this relies on defaults plus a few heuristics. If a Maven build uses 
a custom settings.xml file which contains auth details, ie. when running on CI, 
then this is not picked up by pax-url-aether and it cannot fetch down 
additional content.

The current user settings file is accessible from the MavenSession which is 
already available in Karaf's MojoSupport:

   MavenSession->getRequest->getUserSettingsFile

All that needs to be done is to pass this path to pax-url-aether by setting the 
"org.ops4j.pax.url.mvn.settings" system property. (Note the custom user 
settings file may be null or may not exist, in which case pax-url-aether should 
use the global settings - since it already has code to discover this using 
known locations we don't need to pass the global value)

(I'll attach a patch that implements this suggested solution)


> karaf-maven-plugin doesn't pass custom settings.xml option onto pax-url-aether
> ------------------------------------------------------------------------------
>
>                 Key: KARAF-4288
>                 URL: https://issues.apache.org/jira/browse/KARAF-4288
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-tooling
>    Affects Versions: 4.0.4
>            Reporter: Stuart McCulloch
>         Attachments: KARAF-4288.patch
>
>
> When adding features to a custom distribution karaf-maven-plugin uses 
> pax-url-aether to fetch artifacts which don't yet exist in the local maven 
> repository.
> pax-url-aether has logic to discover the local repository and settings.xml 
> file, but this relies on defaults plus a few heuristics. If a Maven build 
> uses a custom settings.xml file which contains auth details, ie. when running 
> on CI, then this is not picked up by pax-url-aether and it cannot fetch down 
> additional content.
> The current user settings file is accessible from the MavenSession which is 
> already available in Karaf's MojoSupport:
>    MavenSession->getRequest->getUserSettingsFile
> All that needs to be done is to pass this path to pax-url-aether by setting 
> the "org.ops4j.pax.url.mvn.settings" system property. (Note the custom user 
> settings file may be null or may not exist, in which case pax-url-aether 
> should use the global settings - since it already has code to discover this 
> using known locations we don't need to pass the global value, so we just 
> avoid setting "org.ops4j.pax.url.mvn.settings" in this case)
> (I'll attach a patch that implements this suggested solution)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to