Hello guys,

I would need your help with karaf-maven-plugin, please.
I cannot find out the minimal version of Maven which is required to use karaf-maven-plugin:features-generate-descriptor goal (in version 4.0.7).


In the Karaf docs, the only mention of Maven version is in the "4.1.4. Building from Sources" section (http://karaf.apache.org/manual/latest/#_building_from_sources), which states:

    Apache Maven 3.0.4 or greater


We've migrated to Karaf 4.0.7 and that version of the karaf-maven-plugin and our build with Maven 3.0.5 (on our CI server, as locally no one is using Maven 3.0 :-)) fails with a ClassCastException (I am appending the stacktrace at the end of this message).

Seems the changes for https://issues.apache.org/jira/browse/KARAF-884 ( https://github.com/apache/karaf/commit/2d96f914382423762f86c3432587510247beb955 ) have broken the compatibility with Maven 3.0.x as it introduced into GenerateDescriptorMojo.java the usage of the org.eclipse.aether.artifact.DefaultArtifact class which is not compatible with Maven 3.0.


Would you let me know, if this was on purpose and now the minimal Maven version required to use the plugin is 3.1.x or this is a kind of side-effect/regression?

Thank you in advance!

Kind regards
Sergiy


--
Sergiy Shyrkov
Software Architect
Jahia Solutions Group SA
http://www.jahia.com


--------------------

[INFO] --- karaf-maven-plugin:4.0.7:features-generate-descriptor (default-features-generate-descriptor) @ dx-standard --- [INFO] Generating feature descriptor file c:\dev\work\dx-7.2\dxm-dev\jahia-root\features\standard\target\feature\feature.xml [ERROR] org.eclipse.aether.artifact.DefaultArtifact cannot be cast to org.sonatype.aether.artifact.Artifact [INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:09.355s
[INFO] Finished at: Wed Oct 12 15:34:03 CEST 2016
[INFO] Final Memory: 27M/380M
[INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.0.7:features-generate-descriptor (default-features-generate-descriptor) on project dx-standard: Unable to create features.xml file: java.lang.ClassCastException: org.eclipse.aether.artifact.DefaultArtifact cannot be cast to org.sonatype.aether.artifact.Artifact -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.0.7:features-generate-descriptor (default-features-generate-descriptor) on project dx-standard: Unable to create features.xml file: java.lang.ClassCastException: org.eclipse.aether.artifact.DefaultArtifact cannot be cast to org.sonatype.aether.artifact.Artifact at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to create features.xml file: java.lang.ClassCastException: org.eclipse.aether.artifact.DefaultArtifact cannot be cast to org.sonatype.aether.artifact.Artifact at org.apache.karaf.tooling.features.GenerateDescriptorMojo.execute(GenerateDescriptorMojo.java:315) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 19 more
Caused by: java.lang.ClassCastException: org.eclipse.aether.artifact.DefaultArtifact cannot be cast to org.sonatype.aether.artifact.Artifact at org.apache.karaf.tooling.utils.Dependency30Helper.isArtifactAFeature(Dependency30Helper.java:285) at org.apache.karaf.tooling.features.GenerateDescriptorMojo.processFeatureArtifact(GenerateDescriptorMojo.java:517) at org.apache.karaf.tooling.features.GenerateDescriptorMojo.processFeatureArtifact(GenerateDescriptorMojo.java:526) at org.apache.karaf.tooling.features.GenerateDescriptorMojo.writeFeatures(GenerateDescriptorMojo.java:432) at org.apache.karaf.tooling.features.GenerateDescriptorMojo.execute(GenerateDescriptorMojo.java:303)
        ... 21 more

Reply via email to