I figured out what the problem was a few weeks ago and wanted to post an update in case anyone else encounters the same problem. I decided to look at what changes happened in the plugin between 4.1.4 and 4.1.5. I found the following change which gave me an idea :
https://github.com/apache/karaf/commit/218c765d0ec389f44d27d9e837e965028aa30f15 In that commit, a change was made to how the user settings file gets retrieved. Since in Jenkins, we are using the Config File Provider Plugin, I thought maybe what started happening is that when the code was removed from MojoSupport, the customized settings.xml that is generated by the Config File Provider Plugin was no longer getting picked up (it gets generated with server credentials inserted into it in a temporary directory) and passed to pax url aether. So I manually set the org.ops4j.pax.url.mvn.settings property in in mvn command execution in jenkins with an environment variable pointing to the generated settings.xml (-Dorg.ops4j.pax.url.mvn.settings=$M_SETTINGS) and now the Karaf plugin works fine in our Jenkins build. Of course I could be wrong about the above, but after 4.1.4 the karaf maven plugin definitely stopped getting the settings.xml in Jenkins that was generated by that plugin. Obviously noone else appears to be having this issue so it's probably not worth anyone investigating further, but if anyone does hit the issue, that's how to get around it. I can provide more details if anyone needs it. Ryan I tried to move to Karaf 2.0.0 when it came out and our Jenkins build failed like it did for 4.1.5. I noticed we use the On Sun, Feb 25, 2018 at 10:06 PM Jean-Baptiste Onofré <[email protected]> wrote: > François is right: you repo requires an authentication. > > So, check your settings in term of user/password. > > Regards > JB > > On 02/26/2018 03:06 AM, François Papon wrote: > > Hi, > > > > Your repository mvnrepo:8080 required an authentication (401). Are you > using the > > same repository when you build on local ? May be your old job is ok > because the > > artefacts already are in the workspace of Jenkins. > > > > Francois > > > > Le 25 févr. 2018 23:50, Ryan Moquin <[email protected]> a écrit : > > > > Has anyone had any weird issues with the karaf-maven-plugin having > issues > > pulling the framework features xml when building a distribution? > After > > switching to 4.1.5, our jenkins build fails due to a 401 trying to > retrieve > > the 4.1.5 features xml when building a distribution. If I change the > > version back to a previous Karaf version, it works. I can also see > that > > features xml file in our private maven repository and I can access it > > without any issues using the maven credentials our jenkins server is > using. > > I notice the stacktrace is coming from ops4j (and I think I saw in > the Karaf > > release notes the pax url library was updated.) What's weird is > that this > > ONLY happens on our Jenkins server. If I build on my machine > locally which > > uses the same maven proxy settings (to route all requests through our > > private maven server) with the exception of different credentials. > > > > The only thing I can think of that is going on is that our Jenkins > job is > > configured with a custom settings.xml for our build, so the > settings.xml > > isn't in the default location. I'm wondering if somehow when the > > karaf-maven-plugin uses ops4j to retrieve maven resources, it's > somehow not > > picking up the custom maven settings? I'm not sure if this could be > ops4j or > > the karaf plugin... > > > > Does anyone have any pointers how I might be able to troubleshoot > what is > > going on (since this is happening on Jenkins only, it makes > troubleshooting > > a bit trickier): > > > > [DEBUG] Connection released: [id: 0][route: {}->http://mvnrepo:8080 > ][total > > kept alive: 0; route allocated: 0 of 20; total allocated: 0 of 40] > > [WARNING] Error resolving artifact > > org.apache.karaf.features:framework:xml:features:4.1.5: [Could not > transfer > > artifact org.apache.karaf.features:framework:xml:features:4.1.5 > from/to > > nexus-mirror (http://mvnrepo:8080/nexus/content/groups/public/): Not > > authorized , ReasonPhrase:Unauthorized.] > > java.io <http://java.io>.IOException: Error resolving artifact > > org.apache.karaf.features:framework:xml:features:4.1.5: [Could not > transfer > > artifact org.apache.karaf.features:framework:xml:features:4.1.5 > from/to > > nexus-mirror (http://mvnrepo:8080/nexus/content/groups/public/): Not > > authorized , ReasonPhrase:Unauthorized.] > > at > > > > org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:720) > > at > > > > org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:659) > > at > > > > org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:600) > > at > > > > org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:567) > > at > > > > org.apache.karaf.features.internal.download.impl.MavenDownloadTask.download(MavenDownloadTask.java:47) > > at > > > > org.apache.karaf.features.internal.download.impl.AbstractRetryableDownloadTask.run(AbstractRetryableDownloadTask.java:60) > > at > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) > > at java.util.concurrent.FutureTask.run(FutureTask.java:266) > > at > > > > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) > > at > > > > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) > > at > > > > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) > > at > > > > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) > > at java.lang.Thread.run(Thread.java:748) > > Suppressed: shaded.org > > <http://shaded.org>.eclipse.aether.transfer.ArtifactTransferException: > Could > > not transfer artifact > org.apache.karaf.features:framework:xml:features:4.1.5 > > from/to nexus-mirror ( > http://mvnrepo:8080/nexus/content/groups/public/): Not > > authorized , ReasonPhrase:Unauthorized. > > at shaded.org > > <http://shaded.org > >.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:43) > > at shaded.org > > <http://shaded.org > >.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:355) > > at shaded.org > > <http://shaded.org > >.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67) > > at shaded.org > > <http://shaded.org > >.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:581) > > at shaded.org > > <http://shaded.org > >.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:249) > > at shaded.org > > <http://shaded.org > >.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:520) > > at shaded.org > > <http://shaded.org > >.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421) > > at shaded.org > > <http://shaded.org > >.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246) > > at shaded.org > > <http://shaded.org > >.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223) > > at shaded.org > > <http://shaded.org > >.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:294) > > at > > > > org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:705) > > ... 12 more > > Caused by: shaded.org > > <http://shaded.org > >.apache.maven.wagon.authorization.AuthorizationException: > > Not authorized , ReasonPhrase:Unauthorized. > > at shaded.org > > <http://shaded.org > >.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:1022) > > at shaded.org > > <http://shaded.org > >.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:977) > > at shaded.org > > <http://shaded.org > >.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116) > > at shaded.org > > <http://shaded.org > >.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88) > > at shaded.org > > <http://shaded.org > >.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61) > > at shaded.org > > <http://shaded.org > >.eclipse.aether.transport.wagon.WagonTransporter$GetTaskRunner.run(WagonTransporter.java:560) > > at shaded.org > > <http://shaded.org > >.eclipse.aether.transport.wagon.WagonTransporter.execute(WagonTransporter.java:427) > > at shaded.org > > <http://shaded.org > >.eclipse.aether.transport.wagon.WagonTransporter.get(WagonTransporter.java:404) > > at shaded.org > > <http://shaded.org > >.eclipse.aether.connector.basic.BasicRepositoryConnector$GetTaskRunner.runTask(BasicRepositoryConnector.java:447) > > at shaded.org > > <http://shaded.org > >.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:350) > > ... 21 more > > Caused by: shaded.org > > <http://shaded.org > >.eclipse.aether.resolution.ArtifactResolutionException: > > Error resolving artifact > org.apache.karaf.features:framework:xml:features:4.1.5 > > at shaded.org > > <http://shaded.org > >.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444) > > at shaded.org > > <http://shaded.org > >.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246) > > at shaded.org > > <http://shaded.org > >.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223) > > at shaded.org > > <http://shaded.org > >.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:294) > > at > > > > org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:705) > > ... 12 more > > > > -- > Jean-Baptiste Onofré > [email protected] > http://blog.nanthrax.net > Talend - http://www.talend.com >
