Details
Description
Validate feature files (2 or more) in a maven multi module project results in an Exception. All the module use the same parent pom with the following configuration:
<pluginManagement>
<plugins>
...
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>features-maven-plugin</artifactId>
<version>2.3.1</version>
<executions>
<execution>
<id>validate</id>
<phase>process-resources</phase>
<goals>
<goal>validate</goal>
</goals>
<configuration>
<addTransitiveFeatures>true</addTransitiveFeatures>
<file>${project.build.outputDirectory}/features.xml</file>
</configuration>
</execution>
</executions>
</plugin>
...
</plugins>
</pluginManagement>
The modules contains only:
<build>
<plugins>
...
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>features-maven-plugin</artifactId>
</plugin>
...
</plugins>
</build>
Results in the second module are:
[INFO] — features-maven-plugin:2.3.1:validate (validate) @ —
[INFO] == Preparing for validation ==
---------------------------------------------------
constituent[0]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/aether-api-1.13.1.jar
constituent[1]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/aether-connector-wagon-1.13.1.jar
constituent[2]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/aether-impl-1.13.1.jar
constituent[3]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/aether-spi-1.13.1.jar
constituent[4]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/aether-util-1.13.1.jar
constituent[5]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/commons-cli-1.2.jar
constituent[6]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/maven-aether-provider-3.0.5.jar
constituent[7]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/maven-artifact-3.0.5.jar
constituent[8]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/maven-compat-3.0.5.jar
constituent[9]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/maven-core-3.0.5.jar
constituent[10]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/maven-embedder-3.0.5.jar
constituent[11]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/maven-model-3.0.5.jar
constituent[12]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/maven-model-builder-3.0.5.jar
constituent[13]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/maven-plugin-api-3.0.5.jar
constituent[14]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/maven-repository-metadata-3.0.5.jar
constituent[15]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/maven-settings-3.0.5.jar
constituent[16]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/maven-settings-builder-3.0.5.jar
constituent[17]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/plexus-cipher-1.7.jar
constituent[18]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/plexus-component-annotations-1.5.5.jar
constituent[19]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/plexus-interpolation-1.14.jar
constituent[20]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/plexus-sec-dispatcher-1.3.jar
constituent[21]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/plexus-utils-2.0.6.jar
constituent[22]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/sisu-guava-0.9.9.jar
constituent[23]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/sisu-guice-3.1.0-no_aop.jar
constituent[24]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/sisu-inject-bean-2.3.0.jar
constituent[25]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/sisu-inject-plexus-2.3.0.jar
constituent[26]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/wagon-file-2.4.jar
constituent[27]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/wagon-http-2.4-shaded.jar
constituent[28]: file:/V:/Dev/Applications/maven/apache-maven-3.0.5/lib/wagon-provider-api-2.4.jar
---------------------------------------------------
Exception in thread "main" java.lang.Error: factory already defined
at java.net.URL.setURLStreamHandlerFactory(URL.java:1104)
at org.apache.karaf.tooling.features.ValidateFeaturesMojo.prepare(ValidateFeaturesMojo.java:193)
at org.apache.karaf.tooling.features.ValidateFeaturesMojo.execute(ValidateFeaturesMojo.java:160)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
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:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
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)
When only the 'second' module is validated there is no problem in the feature file.