karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Grzegorz Grzybek (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (KARAF-4513) pax-url-aether fails to resolve test-jar artifacts from local repo
Date Mon, 02 Jan 2017 11:35:58 GMT

    [ https://issues.apache.org/jira/browse/KARAF-4513?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15792730#comment-15792730
] 

Grzegorz Grzybek edited comment on KARAF-4513 at 1/2/17 11:35 AM:
------------------------------------------------------------------

For me it works both (karaf 4.0.5) with:
{code:java}
bundle("mvn:grgr.test/bundle-universalis-api/0.1.0.GA/jar/tests")
{code}

and
{code:java}
mavenBundle()
        .groupId("grgr.test")
        .artifactId("bundle-universalis-api")
        .classifier("tests")
        .versionAsInProject()
{code}
+
{code:xml}
<dependency>
    <groupId>grgr.test</groupId>
    <artifactId>bundle-universalis-api</artifactId>
    <type>test-jar</type>
    <version>0.1.0.GA</version>
    <scope>test</scope>
</dependency>
{code}

Remember that dependency's (in POM) {{<type>}} element is not directly translatable
to extension or classifier. In {{maven-core-3.3.9.jar}}, in {{META-INF/plexus/components.xml}}
you have:
{code:xml}
    <component>
      <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
      <role-hint>test-jar</role-hint>
      <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
      <configuration>
        <classifier>tests</classifier>
        <extension>jar</extension>
        <type>test-jar</type>
        <packaging>jar</packaging>
        <language>java</language>
        <addedToClasspath>true</addedToClasspath>
      </configuration>
    </component>
{code}

{{classifier}} is configured directly.
{{extension}} works like this (see {{org.apache.maven.artifact.handler.DefaultArtifactHandler#getExtension()}}):
{code:java}
public String getExtension()
{
    if ( extension == null )
    {
        extension = type;
    }
    return extension;
}
{code}

So in pax-exam → pax-url-aether you're not using this implicit relation, you treat directly
{{type}} as {{extension}}. See {{org.ops4j.pax.exam.options.MavenArtifactUrlReference#getURL()}}.


was (Author: gzres):
For me it works both (karaf 4.0.5) with:
{code:java}
bundle("mvn:grgr.test/bundle-universalis-api/0.1.0.GA/jar/tests")
{code}

and
{code:java}
mavenBundle()
        .groupId("grgr.test")
        .artifactId("bundle-universalis-api")
        .classifier("tests")
        .versionAsInProject()
{code}
+
{code:xml}
<dependency>
    <groupId>grgr.test</groupId>
    <artifactId>bundle-universalis-api</artifactId>
    <type>test-jar</type>
    <version>0.1.0.GA</version>
    <scope>test</scope>
</dependency>
{code}

Remember that dependency's (in POM) {{<type>}} element is not directly translatable
to extension or classifier. In {{maven-core-3.3.9.jar}}, in {{META-INF/plexus/components.xml}}
you have:
{code:xml}
<component>
      <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
      <role-hint>test-jar</role-hint>
      <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
      <configuration>
        <classifier>tests</classifier>
        <extension>jar</extension>
        <type>test-jar</type>
        <packaging>jar</packaging>
        <language>java</language>
        <addedToClasspath>true</addedToClasspath>
      </configuration>
    </component>
{code}

{{classifier}} is configured directly.
{{extension}} works like this (see {{org.apache.maven.artifact.handler.DefaultArtifactHandler#getExtension()}}):
{code:java}
public String getExtension()
{
    if ( extension == null )
    {
        extension = type;
    }
    return extension;
}
{code}

So in pax-exam → pax-url-aether you're not using this implicit relation, you treat directly
{{type}} as {{extension}}. See {{org.ops4j.pax.exam.options.MavenArtifactUrlReference#getURL()}}.

> pax-url-aether fails to resolve test-jar artifacts from local repo
> ------------------------------------------------------------------
>
>                 Key: KARAF-4513
>                 URL: https://issues.apache.org/jira/browse/KARAF-4513
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-core
>    Affects Versions: 4.0.5
>         Environment: JDK 1.8, Win7 x64
>            Reporter: Felix Wassmer
>            Assignee: Grzegorz Grzybek
>
> Since the version upgrade to pax-url-aether 2.4.7 of KARAF-4477 
> Karaf fails to locate maven dependencies of the type test-jar from the local repository
and tries to fetch it from central.
> Every other type is properly resolved from the local repo.
> Current use case:
> Pax exam test has a dependency on the artifact
> {code:xml}
> <dependency>
>     <groupId>org.broken.test</groupId>
>     <artifactId>broken-test-util</artifactId>
>     <version>1.0.0.POM-TEST</version>
>     <type>test-jar</type>
>     <scope>test</scope>
> </dependency>
> {code}
> which causes following execption on startup:
> {noformat}
> 2016-04-29T14:26:45,864 | WARN  | pool-11-thread-7 | 5   - 4j.pax.logging.pax-logging-api
- 1.8.5      | AetherBasedResolver              | Error resolving artifact org.broken.test:broken-test-util:jar:tests:1.0.0.POM-TEST:Could
not find artifact org.broken.test:broken-test-util:jar:tests:1.0.0.POM-TEST in central (http://repo1.maven.org/maven2/)
> shaded.org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact
org.broken.test:broken-test-util:jar:tests:1.0.0.POM-TEST in central (http://repo1.maven.org/maven2/)
> 	at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
[4:org.ops4j.pax.url.mvn:2.4.7]
> 	at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
[4:org.ops4j.pax.url.mvn:2.4.7]
> 	at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
[4:org.ops4j.pax.url.mvn:2.4.7]
> 	at shaded.org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:294)
[4:org.ops4j.pax.url.mvn:2.4.7]
> 	at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:650)
[4:org.ops4j.pax.url.mvn:2.4.7]
> 	at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:598)
[4:org.ops4j.pax.url.mvn:2.4.7]
> 	at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:576)
[4:org.ops4j.pax.url.mvn:2.4.7]
> 	at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:550)
[4:org.ops4j.pax.url.mvn:2.4.7]
> 	at org.apache.karaf.features.internal.download.impl.MavenDownloadTask.download(MavenDownloadTask.java:34)
[9:org.apache.karaf.features.core:4.0.5]
> 	at org.apache.karaf.features.internal.download.impl.AbstractRetryableDownloadTask.run(AbstractRetryableDownloadTask.java:58)
[9:org.apache.karaf.features.core:4.0.5]
> 	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:745) [?:?]
> Caused by: shaded.org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find
artifact org.broken.test:broken-test-util:jar:tests:1.0.0.POM-TEST in central (http://repo1.maven.org/maven2/)
> 	at shaded.org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:39)
~[?:?]
> 	at shaded.org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:355)
~[?:?]
> 	at shaded.org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67)
~[?:?]
> 	at shaded.org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:581)
~[?:?]
> 	at shaded.org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:249)
~[?:?]
> 	at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:520)
~[?:?]
> 	at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
~[?:?]
> 	... 16 more
> {noformat}
> With pax-url-aether version 2.4.6 or lower everything works as expected.



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

Mime
View raw message