karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Lietz <apa...@oliverlietz.de>
Subject Re: Troubles to upgrade from 3.0.5 to 4.0.5 (karaf maven plugin behavior changes)
Date Mon, 13 Jun 2016 06:50:47 GMT
On Sunday 12 June 2016 16:29:21 Richard Kosegi wrote:
> Hi Karaf folks,

Hello Richard,

> I have a question about changed behaviour of karaf-maven-plugin between
> versions 3.0.5 and 4.0.5.
> 
> While using 3.0.5 my feature is correctly recognized in "assembly"  goal,
> where in 4.0.5 it is not due to this error:
> 
> Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to build
> assembly
>     at org.apache.karaf.tooling.AssemblyMojo.execute(AssemblyMojo.java:234)
>     at
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPl
> uginManager.java:134) at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:2
> 08) ... 20 more
> Caused by: java.lang.IllegalStateException: Could not find matching feature
> for myfeature-thirdparty/0.2.4-SNAPSHOT
>     at
> org.apache.karaf.profile.assembly.Builder.addFeatures(Builder.java:1079)
>     at
> org.apache.karaf.profile.assembly.Builder.addFeatures(Builder.java:1072)
>     at
> org.apache.karaf.profile.assembly.Builder.addFeatures(Builder.java:1072)
>     at org.apache.karaf.profile.assembly.Builder.bootStage(Builder.java:811)
> at
> org.apache.karaf.profile.assembly.Builder.doGenerateAssembly(Builder.java:61
> 1) at
> org.apache.karaf.profile.assembly.Builder.generateAssembly(Builder.java:389)
> at
> org.apache.karaf.tooling.AssemblyMojo.doExecute(AssemblyMojo.java:392)
>     at org.apache.karaf.tooling.AssemblyMojo.execute(AssemblyMojo.java:228)
>     ... 22 more
> 
> Problem seems to be somehow connected to how OSGi versions artifacts versus
> how maven versions snapshots.
> I'm assuming that this only affects SNAPSHOT versions.
> 
> Here is my feature:
> 
>     <feature name="myfeature-all" start-level="50" resolver="(obr)"
> description="My all features" version="${project.version}">
>         <feature version="${project.version}">myfeature-thirdparty</feature>
> <feature version="${project.version}">myfeature-core</feature> </feature>
> 
> 
> I was able to workaround this problem by ugly hack below, but I guess I'm
> missing something very elemenary.

no. This is a known issue: https://issues.apache.org/jira/browse/KARAF-4105

I hope Jean-Baptiste finds some time to look into this.
In the meantime you could use the patch from Markus Rathgeb.

> Please suggest.
> 
> Here is ugly hack:
> 
> 
> git diff -- ./src/main/java/org/apache/karaf/profile/assembly/Builder.java
> diff --git
> a/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java
> b/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java
> index b4daa50..de47483 100644
> --- a/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java
> +++ b/profile/src/main/java/org/apache/karaf/profile/assembly/Builder.java
> @@ -1094,7 +1094,7 @@ public class Builder {
>       * @return
>       */
>      private boolean matches(Feature f, Dependency featureRef) {
> -        String version = featureRef.getVersion();
> +        String version = featureRef.getVersion().replace("-SNAPSHOT",
> ".SNAPSHOT");
>          return f.getName().equals(featureRef.getName())
>              && (version == null || version.equals("0.0.0")||
> version.startsWith("[") || f.getVersion().equals(version));
>      }
> 

Regards,
O.

> Thanks!
> 
> Richard.


Mime
View raw message