You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by "Althaus, Volker" <v....@cenit.de> on 2016/08/12 08:35:46 UTC

karaf-maven-plugin - Resolution with artifact repository fails when not connected to the internet

Hi,
I use the add-features-to-repo goal for creating a custom distribution (Karaf 4.0.4).

I want to include the "camel-restlet" feature which has the following dependency:

<bundle dependency='true'>mvn:http://maven.restlet.org!org.restlet.osgi/org.restlet/2.3.1</bundle>

The problem is that the build system isn't connected to the internet, instead we have a Nexus repository which is set as the only repository in the Maven POM.
The artifact is hosted there and it is also already cached in the local Maven repository, so there's absolutely no need to connect to http://maven.restlet.org.

Now my build fails because the plugin ignores my Maven setup and the feature resolution mechanism always tries to connect to this external repository.

I looked at the code and the following lines seem to confirm this behavior:

AbstractFeatureMojo.java
/**
 * Resolves and copies the given artifact to the repository path.
 * Prefers to resolve using the repository of the artifact if present.
 */
protected void resolveArtifact(Artifact artifact, List<ArtifactRepository> remoteRepos) {
        List<ArtifactRepository> usedRemoteRepos = artifact.getRepository() != null ? Collections.singletonList(artifact.getRepository()) : remoteRepos;
        resolver.resolve(artifact, usedRemoteRepos, localRepo);


Any ideas how to get my build to work without changing the feature definition? I want to avoid this.


Regards
  Volker


CENIT AG, Industriestrasse 52-54, 70565 Stuttgart, Tel.: +49 711 7825-30, Fax: +49 711 7825-4000, Internet: www.cenit.com
Geschaeftsstellen: Berlin, Frankfurt, Hamburg, Hannover, Muenchen, Oelsnitz, Ratingen, Saarbruecken
Vorstandsmitglieder: Kurt Bengel, Matthias Schmidt
Aufsichtsratsmitglieder: Andreas Schmidt (Vorsitzender des Aufsichtsrats), Hubert Leypoldt, Andreas Karrer
Bankverbindungen:
Deutsche Bank (BLZ 600 700 70) Kto. 1661 040 IBAN : DE85 6007 0070 0166 1040 00 SWIFT-CODE : DEUTDESS,
Commerzbank (BLZ 600 400 71) Kto. 532 015 500 IBAN : DE83 6004 0071 0532 0155 00 SWIFT-Code : COBADEFF600,
Registergericht: Amtsgericht Stuttgart
Handelsregister: HRB Nr. 19117
Umsatzsteuer: ID-Nr. DE 147 862 777


AW: karaf-maven-plugin - Resolution with artifact repository fails when not connected to the internet

Posted by "Althaus, Volker" <v....@cenit.de>.
Hi,
I found a temporary solution for this problem: When I define the artifact as a dependency in my Maven POM, it's getting downloaded to the local repository at the
begin of the build using our Nexus.

Then I configured the karaf-maven-plugin with failOnArtifactResolutionError=false.

As the result the plugin searches for the artifact, runs into a timeout after 4 minutes, but nevertheless pulls the artifact from the local repository afterwards.

Unfortunately this is not a suitable workaround for us because it extremely increases our overall build time.

Any other ideas someone?


Regards,
  Volker

-----Ursprüngliche Nachricht-----
Von: Althaus, Volker 
Gesendet: Freitag, 12. August 2016 10:36
An: user@karaf.apache.org
Betreff: karaf-maven-plugin - Resolution with artifact repository fails when not connected to the internet

Hi,
I use the add-features-to-repo goal for creating a custom distribution (Karaf 4.0.4).

I want to include the "camel-restlet" feature which has the following dependency:

<bundle dependency='true'>mvn:http://maven.restlet.org!org.restlet.osgi/org.restlet/2.3.1</bundle>

The problem is that the build system isn't connected to the internet, instead we have a Nexus repository which is set as the only repository in the Maven POM.
The artifact is hosted there and it is also already cached in the local Maven repository, so there's absolutely no need to connect to http://maven.restlet.org.

Now my build fails because the plugin ignores my Maven setup and the feature resolution mechanism always tries to connect to this external repository.

I looked at the code and the following lines seem to confirm this behavior:

AbstractFeatureMojo.java
/**
 * Resolves and copies the given artifact to the repository path.
 * Prefers to resolve using the repository of the artifact if present.
 */
protected void resolveArtifact(Artifact artifact, List<ArtifactRepository> remoteRepos) {
        List<ArtifactRepository> usedRemoteRepos = artifact.getRepository() != null ? Collections.singletonList(artifact.getRepository()) : remoteRepos;
        resolver.resolve(artifact, usedRemoteRepos, localRepo);


Any ideas how to get my build to work without changing the feature definition? I want to avoid this.


CENIT AG, Industriestrasse 52-54, 70565 Stuttgart, Tel.: +49 711 7825-30, Fax: +49 711 7825-4000, Internet: www.cenit.com
Geschaeftsstellen: Berlin, Frankfurt, Hamburg, Hannover, Muenchen, Oelsnitz, Ratingen, Saarbruecken
Vorstandsmitglieder: Kurt Bengel, Matthias Schmidt
Aufsichtsratsmitglieder: Andreas Schmidt (Vorsitzender des Aufsichtsrats), Hubert Leypoldt, Andreas Karrer
Bankverbindungen:
Deutsche Bank (BLZ 600 700 70) Kto. 1661 040 IBAN : DE85 6007 0070 0166 1040 00 SWIFT-CODE : DEUTDESS,
Commerzbank (BLZ 600 400 71) Kto. 532 015 500 IBAN : DE83 6004 0071 0532 0155 00 SWIFT-Code : COBADEFF600,
Registergericht: Amtsgericht Stuttgart
Handelsregister: HRB Nr. 19117
Umsatzsteuer: ID-Nr. DE 147 862 777