Error when generating allure report with jasmine allure reporter - allure

I am using jasmine allure reporter. When I ran My test suite got pom.xml generated. But when I wanted to run "mvn site -Dallure.results_pattern=allure-results" command in target directery, getting the following error. Any help highly appreciated.
[INFO] Rendering site with org.apache.maven.skins:maven-default-skin:jar:1.0 ski
n.
[INFO] Generating "Allure" report --- allure-maven-plugin:2.2
[INFO] Report Version: 1.4.15
[INFO] Results Pattern: allure-results
[INFO] Found [0] results directories by pattern [allure-results]
[INFO] Found [0] plugins
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:44 min
[INFO] Finished at: 2016-09-02T17:54:15+05:30
[INFO] Final Memory: 19M/161M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.3:si
te (default-site) on project protractor-allure-plugin-generate-html: Error during page generation: Error rendering Maven report: Can't find any results directories by pattern [allure-results] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, pleaseread the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
my pom.xml is:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ru.yandex.allure</groupId>
<artifactId>protractor-allure-plugin-generate-html</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<allure.version>1.4.15</allure.version>
<allure.maven.version>2.2</allure.maven.version>
<!-- Relative to the dir you're running from -->
<allure.results_pattern>allure-results</allure.results_pattern>
</properties>
<dependencies>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-report-face</artifactId>
<version>${allure.version}</version>
<type>war</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.10.v20150310</version>
<configuration>
<webAppSourceDirectory>target/site/allure-maven-plugin</webAppSourceDirectory>
<stopKey>stop</stopKey>
<stopPort>2299</stopPort>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<excludeDefaults>true</excludeDefaults>
<plugins>
<plugin>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-maven-plugin</artifactId>
<version>${allure.maven.version}</version>
<configuration>
<resultsPattern>${allure.results_pattern}</resultsPattern>
<!--<reportVersion>1.4.15</reportVersion>-->
</configuration>
</plugin>
</plugins>
</reporting>
</project>

Related

Heroku Springboot Err: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile

I am trying to get my Springboot Backend application to compile on Heroku.
I get the message: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile
I am totally lost and in the weeds on this.
Any help would be appreciated.
I do not even know how or where to add the -e or -X switch (referenced below).
Here is the applicable portion of the log and my POM file.
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/com/thoughtworks/qdox/qdox/2.0-M9/qdox-2.0-M9.jar (317 kB at 10 MB/s)
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) # budget-backend ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory /tmp/build_edc50946/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) # budget-backend ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /tmp/build_edc50946/target/test-classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.635 s
[INFO] Finished at: 2022-03-07T15:09:33Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile (default-testCompile) on project budget-backend: Fatal error compiling: invalid target release: 11 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
! ERROR: Failed to build app with Maven
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>net.javaguides</groupId>
<artifactId>budget-backend</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>budget-backend</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
I added a system.properties file with 'java.runtime.version=11' and the error message from Heroku now says:
Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.5.0:repackage failed: Unable to find main class
Did I make things worse or am I getting closer?
Problem solved. I do not understand why, but it compiles on Heroku now.
I added a system.properties file with the following entry
java.runtime.version=11.
I also changed the POM to read
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>

Allure Report using Jenkins displays wrong data

I am using Java, Maven and TestNG.
I would like to add Allure for reporting in Jenkins.
I have added following configuration in pom.xml:
Dependency:
<!-- https://mvnrepository.com/artifact/io.qameta.allure/allure-testng -->
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>2.12.1</version>
</dependency>
Profile:
<profile>
<id>UI</id>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>ui.xml</suiteXmlFile>
</suiteXmlFiles>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</argLine>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>LATEST_VERSION</version>
<configuration>
<reportVersion>2.4.1</reportVersion>
<reportDirectory>target/allure-results</reportDirectory>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
When I run tests locally using command:
clean test -PUI -f pom.xml
Most of the tests are passed.
[INFO] Results:
[INFO]
[INFO]
[ERROR] Tests run: 25, Failures: 6, Errors: 0, Skipped: 9
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13:39 min
[INFO] Finished at: 2019-06-21T11:30:09+03:00
[INFO] Final Memory: 23M/259M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test (default-test) on project company: There are test failures.
However, "allure-results" is created in the root of project, but I have a config for "target/allure-results". While running tests locally using not Maven, but TestNG directly all tests are passed.
I installed Allure plugin in Jenkins, added configuration to Jenkins job:
However, after Jenkins job is finished I see that in Console Output some tests are passed, but it's shown that number of tests that were passed/running/failed is 0. And in Allure almost all tests are failed in a strange way - BeforeTest was failed, but Test was passed.
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[ERROR] There are test failures.
[JENKINS] Recording test results
[WARNING] Attempt to (de-)serialize anonymous class org.jfrog.hudson.maven2.MavenDependenciesRecorder$1; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 09:57 min
[INFO] Finished at: 2019-06-21T07:43:30+00:00
[INFO] Final Memory: 30M/313M
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[JENKINS] Archiving /var/lib/jenkins/workspace/tests.env.test/ui-test/pom.xml to com.company/company/1.0-SNAPSHOT/company-1.0-SNAPSHOT.pom
channel stopped
[ui-test] $ /var/lib/jenkins/tools/ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation/allure/bin/allure generate -c -o /var/lib/jenkins/workspace/tests.env.test/ui-test/allure-report
Report successfully generated to /var/lib/jenkins/workspace/tests.env.test/ui-test/allure-report
Allure report was successfully generated.
Creating artifact for the build.
Artifact was added to the build.
Build step 'Allure Report' changed build result to UNSTABLE
Finished: UNSTABLE
By default Allure results files are stored in project root. In order to change location create an allure.properties file in your test resources directory (src/test/resources) with the following content:
allure.results.directory=target/allure-results
For more details please see the docs https://docs.qameta.io/allure/#_configuration

Maven JAR plugin skipping generated-resources folder

I am facing a strange issue while trying to run a simple AngularJS Spring Boot project (after sorting out the issues mentioned in this thread). Following is my Maven POM. The issue I am facing is that while the Wro4j plugin is able to generate the JS/CSS files under generated-resources, and despite that under build/resources I have provided the paths to be packaged, the files under generated-resources are not getting packaged within the JAR under "static" folder (only my custom JS file and the index.html file appear there). How could this be corrected?
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-angularjs</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>org.test</groupId>
<artifactId>my-microservice-parent</artifactId>
<version>0.1.0-SNAPSHOT</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<wro4j.version>1.8.0</wro4j.version>
<java.version>1.8</java.version>
<bootstrap.version>3.3.7-1</bootstrap.version>
<angularjs.version>1.5.9</angularjs.version>
<jquery.version>3.1.1-1</jquery.version>
</properties>
<dependencies>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>angularjs</artifactId>
<version>${angularjs.version}</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jasmine</artifactId>
<version>2.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka-server</artifactId>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>${project.build.directory}/generated-resources</directory>
</resource>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<!-- Serves *only* to filter the wro.xml so it can get an absolute
path for the project -->
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/wro</outputDirectory>
<resources>
<resource>
<directory>src/main/wro</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>ro.isdc.wro4j</groupId>
<artifactId>wro4j-maven-plugin</artifactId>
<version>${wro4j.version}</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<configuration>
<wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory>
<cssDestinationFolder>${project.build.directory}/generated-resources/static/css</cssDestinationFolder>
<jsDestinationFolder>${project.build.directory}/generated-resources/static/js</jsDestinationFolder>
<wroFile>${project.build.directory}/wro/wro.xml</wroFile>
<!--
<extraConfigFile>${basedir}/src/main/wro/wro.properties</extraConfigFile>
<contextFolder>${basedir}/src/main/wro</contextFolder>
-->
<extraConfigFile>${project.build.directory}/wro/wro.properties</extraConfigFile>
<contextFolder>${project.build.directory}/wro</contextFolder>
</configuration>
<dependencies>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>${jquery.version}</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>angularjs</artifactId>
<version>${angularjs.version}</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>${bootstrap.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>angularjs</artifactId>
<version>${angularjs.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
Following is the Maven build log (for mvn clean package):
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building spring-angularjs 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # spring-angularjs ---
[INFO] Deleting C:\projects\spring-angularjs\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:copy-resources (copy-resources) # spring-angularjs ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # spring-angularjs ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\projects\spring-angularjs\target\generated-resources
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # spring-angularjs ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to C:\projects\spring-angularjs\target\classes
[INFO]
[INFO] --- wro4j-maven-plugin:1.8.0:run (default) # spring-angularjs ---
[INFO] C:\projects\spring-angularjs\target/wro
[INFO] Executing the mojo:
[INFO] Wro4j Model path: C:\projects\spring-angularjs\target\wro\wro.xml
[INFO] targetGroups: null
[INFO] minimize: true
[INFO] ignoreMissingResources: null
[INFO] parallelProcessing: false
[INFO] buildDirectory: C:\projects\spring-angularjs\target
[INFO] destinationFolder: C:\projects\spring-angularjs\target
[INFO] jsDestinationFolder: C:\projects\spring-angularjs\target\generated-resources\static\js
[INFO] cssDestinationFolder: C:\projects\spring-angularjs\target\generated-resources\static\css
[INFO] The following groups will be processed: [angular-bootstrap]
[INFO] folder: C:\projects\spring-angularjs\target\generated-resources\static\css
[INFO] processing group: angular-bootstrap.css
[WARNING] Less warnings are:
[WARNING] 10:1 Cannot link source map. Css result location is not know and could not be deduced from input less source..
[INFO] file size: angular-bootstrap.css -> 145074 bytes
[INFO] C:\projects\spring-angularjs\target\generated-resources\static\css\angular-bootstrap.css (145074 bytes)
[INFO] folder: C:\projects\spring-angularjs\target\generated-resources\static\js
[INFO] processing group: angular-bootstrap.js
[INFO] file size: angular-bootstrap.js -> 254638 bytes
[INFO] C:\projects\spring-angularjs\target\generated-resources\static\js\angular-bootstrap.js (254638 bytes)
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # spring-angularjs ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\projects\spring-angularjs\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # spring-angularjs ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) # spring-angularjs ---
[INFO] No tests to run.
[INFO]
[INFO] --- jasmine-maven-plugin:2.0:test (default) # spring-angularjs ---
[INFO] jetty-8.1.14.v20131031
[INFO] Started SelectChannelConnector#0.0.0.0:60402
[INFO] Executing Jasmine Specs
[INFO] Resolved artifact C:\Users\XXXXX\.m2\repository\com\github\klieber\phantomjs\2.0.0\phantomjs-2.0.0-windows.zip from remote-repos-vr (https://vrartifactory.eficode.com/remote-repos-vr, default, releases+snapshots)
[INFO] Extracting C:\Users\XXXXX\.m2\repository\com\github\klieber\phantomjs\2.0.0\phantomjs-2.0.0-windows.zip\phantomjs-2.0.0-windows\bin\phantomjs.exe to C:\projects\spring-angularjs\target\phantomjs\phantomjs-2.0.0-windows\bin\phantomjs.exe
[INFO]
-------------------------------------------------------
J A S M I N E S P E C S
-------------------------------------------------------
[INFO]
Results: 0 specs, 0 failures, 0 pending
[INFO] stopped o.e.j.s.h.ContextHandler{/webjars,file:/C:/projects/spring-angularjs/}
[INFO] stopped o.e.j.s.h.ContextHandler{/classpath,file:/C:/projects/spring-angularjs/}
[INFO] stopped o.e.j.s.h.ContextHandler{/,file:/C:/projects/spring-angularjs/}
[INFO] stopped o.e.j.s.h.ContextHandler{/spec,file:/C:/projects/spring-angularjs/}
[INFO] stopped o.e.j.s.h.ContextHandler{/src,file:/C:/projects/spring-angularjs/}
[INFO]
[INFO] --- maven-jar-plugin:2.5:jar (default-jar) # spring-angularjs ---
[INFO] Building jar: C:\projects\spring-angularjs\target\spring-angularjs-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:1.3.8.RELEASE:repackage (default) # spring-angularjs ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 32.848 s
[INFO] Finished at: 2017-11-09T16:04:39+05:30
[INFO] Final Memory: 98M/503M
[INFO] ------------------------------------------------------------------------
wro4j-maven-plugin:run is running at compile phase, after the process-resources phases where all resources are copied to ${project.build.outputDirectory} (by default target/classes). Only files from this folder are included into your JAR, but your CSS/JS files are generated after Maven tried to copy them to the outputDirectory, thus never being added.
You simply have to configure Wro4j plugin to run during generate-resources phase:
<plugin>
<groupId>ro.isdc.wro4j</groupId>
<artifactId>wro4j-maven-plugin</artifactId>
<version>${wro4j.version}</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
...
</plugin>
If for some reasons your files cannot be generated before compile (maybe it requires your code to be compiled), you'll have instead to manually add your resources into your project build output directory with the Maven Resources Plugin after they are generated as you did in your comment - though I would recommend doing it during the prepare-package phase using ${project.build.outputDirectory} such as:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<execution>
<id>copy-resources-post-compile</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}</outputDir‌​ector‌​y>
<resources>
<resource>
<directory>${project.build.directory}/generated-res‌​ources</directory>
</resource>
</resources>
</configuration>
</execution>
</plugin>
EDIT: To learn more about the Maven lifecycle, phases and goals, see Intro to Build Lifecycle and this tutorial explains things well. Also take a look at the default bindings to see which plugins are run by default depending on your packaging.

Creating a single camel application bundle with all dependencies using maven3

I am trying to create a camel application bundle so that I can run it in service mix 6.1.0 under karaf.
As per Ralf I tried the KAR format. My pom.xml looks like below:-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.jabong.orchestratorservice</groupId>
<artifactId>basecomponent</artifactId>
<version>1.0</version>
<packaging>kar</packaging>
<name>basecomponent</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>com.github.arnabk</groupId>
<artifactId>java-dogstatsd-client</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20151123</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jetty</artifactId>
<version>2.16.1</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-http4</artifactId>
<version>2.16.1</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>2.16.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.13</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test</artifactId>
<version>2.16.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>
com.googlecode.maven-java-formatter-plugin
</groupId>
<artifactId>maven-java-formatter-plugin</artifactId>
<version>0.4</version>
</dependency>
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>4.5.1</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.13</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.0.13</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>easyb</id>
<!-- When maven.test.skip is defined, don't run easyb tests. Ideally,
it should check for skipTests flag too,but maven profile activation doesn't
support multiple variables. More details is here http://jira.codehaus.org/browse/MNG-3328.
There is also easyb ticket created for this issue: https://code.google.com/p/easyb/issues/detail?id=192. -->
<activation>
<property>
<name>!maven.test.skip</name>
</property>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.easyb</groupId>
<artifactId>maven-easyb-plugin</artifactId>
<version>0.9</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<storyType>html</storyType>
<storyReport>${project.build.directory}/easyb/stories.txt</storyReport>
</configuration>
</plugin>
<plugin>
<groupId>com.googlecode.maven-java-formatter-plugin</groupId>
<artifactId>maven-java-formatter-plugin</artifactId>
<version>0.4</version>
<configuration>
<compilerSource>1.8</compilerSource>
<compilerCompliance>1.8</compilerCompliance>
<compilerTargetPlatform>1.8</compilerTargetPlatform>
<configFile>${project.basedir}/code_format_java.xml</configFile>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Description>${project.description}</Bundle-Description>
<Import-Package>*;resolution:=optional</Import-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>4.0.0</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
On doing mvn install I am getting the below error:-
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.jabong.orchestratorservice:basecomponent:kar:1.0
[WARNING] 'build.plugins.plugin.version' for org.apache.felix:maven-bundle-plugin is missing. # line 152, column 14
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building basecomponent 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) # basecomponent ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- karaf-maven-plugin:4.0.0:features-generate-descriptor (default-features-generate-descriptor) # basecomponent ---
[INFO] Generating feature descriptor file /home/jabong/code/github.com/jabong/orchestrator-service/basecomponent/target/feature/feature.xml
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/1.5.5/plexus-utils-1.5.5.jar
Exception in thread "pool-1-thread-1" java.lang.NoSuchMethodError: org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.getReadTimeout()I
at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.execute(AbstractHttpClientWagon.java:798)
at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:1000)
at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:977)
at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:601)
at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
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)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.574s
[INFO] Finished at: Wed Feb 24 23:12:56 IST 2016
[INFO] Final Memory: 21M/341M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.0.0:features-generate-descriptor (default-features-generate-descriptor) on project basecomponent: Execution default-features-generate-descriptor of goal org.apache.karaf.tooling:karaf-maven-plugin:4.0.0:features-generate-descriptor failed: An API incompatibility was encountered while executing org.apache.karaf.tooling:karaf-maven-plugin:4.0.0:features-generate-descriptor: java.lang.NoSuchMethodError: org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.getReadTimeout()I
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.apache.karaf.tooling:karaf-maven-plugin:4.0.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/home/jabong/.m2/repository/org/apache/karaf/tooling/karaf-maven-plugin/4.0.0/karaf-maven-plugin-4.0.0.jar
[ERROR] urls[1] = file:/home/jabong/.m2/repository/org/sonatype/sisu/sisu-inject-bean/2.1.1/sisu-inject-bean-2.1.1.jar
[ERROR] urls[2] = file:/home/jabong/.m2/repository/org/sonatype/sisu/sisu-guice/2.9.4/sisu-guice-2.9.4-no_aop.jar
[ERROR] urls[3] = file:/home/jabong/.m2/repository/org/sonatype/aether/aether-util/1.11/aether-util-1.11.jar
[ERROR] urls[4] = file:/home/jabong/.m2/repository/org/eclipse/aether/aether-api/0.9.0.M2/aether-api-0.9.0.M2.jar
[ERROR] urls[5] = file:/home/jabong/.m2/repository/org/eclipse/aether/aether-util/0.9.0.M2/aether-util-0.9.0.M2.jar
[ERROR] urls[6] = file:/home/jabong/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
[ERROR] urls[7] = file:/home/jabong/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[8] = file:/home/jabong/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[9] = file:/home/jabong/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[10] = file:/home/jabong/.m2/repository/org/apache/maven/plugin-tools/maven-plugin-annotations/3.3/maven-plugin-annotations-3.3.jar
[ERROR] urls[11] = file:/home/jabong/.m2/repository/org/apache/maven/wagon/wagon-http/2.8/wagon-http-2.8.jar
[ERROR] urls[12] = file:/home/jabong/.m2/repository/org/apache/maven/wagon/wagon-http-shared/2.8/wagon-http-shared-2.8.jar
[ERROR] urls[13] = file:/home/jabong/.m2/repository/org/jsoup/jsoup/1.7.2/jsoup-1.7.2.jar
[ERROR] urls[14] = file:/home/jabong/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
[ERROR] urls[15] = file:/home/jabong/.m2/repository/commons-io/commons-io/2.2/commons-io-2.2.jar
[ERROR] urls[16] = file:/home/jabong/.m2/repository/org/apache/httpcomponents/httpclient/4.3.5/httpclient-4.3.5.jar
[ERROR] urls[17] = file:/home/jabong/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar
[ERROR] urls[18] = file:/home/jabong/.m2/repository/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar
[ERROR] urls[19] = file:/home/jabong/.m2/repository/org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2.jar
[ERROR] urls[20] = file:/home/jabong/.m2/repository/org/apache/karaf/org.apache.karaf.util/4.0.0/org.apache.karaf.util-4.0.0.jar
[ERROR] urls[21] = file:/home/jabong/.m2/repository/org/apache/felix/org.apache.felix.utils/1.8.0/org.apache.felix.utils-1.8.0.jar
[ERROR] urls[22] = file:/home/jabong/.m2/repository/org/slf4j/slf4j-api/1.7.12/slf4j-api-1.7.12.jar
[ERROR] urls[23] = file:/home/jabong/.m2/repository/org/apache/karaf/jaas/org.apache.karaf.jaas.boot/4.0.0/org.apache.karaf.jaas.boot-4.0.0.jar
[ERROR] urls[24] = file:/home/jabong/.m2/repository/org/slf4j/slf4j-jdk14/1.7.12/slf4j-jdk14-1.7.12.jar
[ERROR] urls[25] = file:/home/jabong/.m2/repository/org/apache/maven/shared/maven-filtering/1.0-beta-4/maven-filtering-1.0-beta-4.jar
[ERROR] urls[26] = file:/home/jabong/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
[ERROR] urls[27] = file:/home/jabong/.m2/repository/org/sonatype/plexus/plexus-build-api/0.0.4/plexus-build-api-0.0.4.jar
[ERROR] urls[28] = file:/home/jabong/.m2/repository/org/codehaus/plexus/plexus-utils/3.0/plexus-utils-3.0.jar
[ERROR] urls[29] = file:/home/jabong/.m2/repository/org/apache/felix/maven-bundle-plugin/2.5.4/maven-bundle-plugin-2.5.4.jar
[ERROR] urls[30] = file:/home/jabong/.m2/repository/biz/aQute/bnd/biz.aQute.bndlib/2.4.1/biz.aQute.bndlib-2.4.1.jar
[ERROR] urls[31] = file:/home/jabong/.m2/repository/org/apache/maven/maven-archiver/2.5/maven-archiver-2.5.jar
[ERROR] urls[32] = file:/home/jabong/.m2/repository/org/codehaus/plexus/plexus-archiver/2.1/plexus-archiver-2.1.jar
[ERROR] urls[33] = file:/home/jabong/.m2/repository/org/codehaus/plexus/plexus-io/2.0.2/plexus-io-2.0.2.jar
[ERROR] urls[34] = file:/home/jabong/.m2/repository/org/apache/maven/shared/maven-dependency-tree/2.1/maven-dependency-tree-2.1.jar
[ERROR] urls[35] = file:/home/jabong/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.0/doxia-sink-api-1.0.jar
[ERROR] urls[36] = file:/home/jabong/.m2/repository/org/apache/maven/doxia/doxia-site-renderer/1.0/doxia-site-renderer-1.0.jar
[ERROR] urls[37] = file:/home/jabong/.m2/repository/org/apache/maven/doxia/doxia-core/1.0/doxia-core-1.0.jar
[ERROR] urls[38] = file:/home/jabong/.m2/repository/org/codehaus/plexus/plexus-i18n/1.0-beta-7/plexus-i18n-1.0-beta-7.jar
[ERROR] urls[39] = file:/home/jabong/.m2/repository/org/codehaus/plexus/plexus-velocity/1.1.7/plexus-velocity-1.1.7.jar
[ERROR] urls[40] = file:/home/jabong/.m2/repository/org/apache/velocity/velocity/1.5/velocity-1.5.jar
[ERROR] urls[41] = file:/home/jabong/.m2/repository/oro/oro/2.0.8/oro-2.0.8.jar
[ERROR] urls[42] = file:/home/jabong/.m2/repository/org/apache/maven/doxia/doxia-decoration-model/1.0/doxia-decoration-model-1.0.jar
[ERROR] urls[43] = file:/home/jabong/.m2/repository/commons-collections/commons-collections/3.2/commons-collections-3.2.jar
[ERROR] urls[44] = file:/home/jabong/.m2/repository/org/apache/maven/doxia/doxia-module-apt/1.0/doxia-module-apt-1.0.jar
[ERROR] urls[45] = file:/home/jabong/.m2/repository/org/apache/maven/doxia/doxia-module-fml/1.0/doxia-module-fml-1.0.jar
[ERROR] urls[46] = file:/home/jabong/.m2/repository/org/apache/maven/doxia/doxia-module-xdoc/1.0/doxia-module-xdoc-1.0.jar
[ERROR] urls[47] = file:/home/jabong/.m2/repository/org/apache/maven/doxia/doxia-module-xhtml/1.0/doxia-module-xhtml-1.0.jar
[ERROR] urls[48] = file:/home/jabong/.m2/repository/org/apache/felix/org.apache.felix.fileinstall/3.5.0/org.apache.felix.fileinstall-3.5.0.jar
[ERROR] urls[49] = file:/home/jabong/.m2/repository/org/apache/karaf/features/org.apache.karaf.features.core/4.0.0/org.apache.karaf.features.core-4.0.0.jar
[ERROR] urls[50] = file:/home/jabong/.m2/repository/org/apache/karaf/profile/org.apache.karaf.profile.core/4.0.0/org.apache.karaf.profile.core-4.0.0.jar
[ERROR] urls[51] = file:/home/jabong/.m2/repository/org/apache/felix/org.apache.felix.resolver/1.4.0/org.apache.felix.resolver-1.4.0.jar
[ERROR] urls[52] = file:/home/jabong/.m2/repository/org/ops4j/pax/url/pax-url-wrap/2.4.1/pax-url-wrap-2.4.1-uber.jar
[ERROR] urls[53] = file:/home/jabong/.m2/repository/org/ops4j/base/ops4j-base-net/1.4.0/ops4j-base-net-1.4.0.jar
[ERROR] urls[54] = file:/home/jabong/.m2/repository/org/ops4j/base/ops4j-base-lang/1.5.0/ops4j-base-lang-1.5.0.jar
[ERROR] urls[55] = file:/home/jabong/.m2/repository/org/ops4j/base/ops4j-base-monitors/1.4.0/ops4j-base-monitors-1.4.0.jar
[ERROR] urls[56] = file:/home/jabong/.m2/repository/org/ops4j/pax/swissbox/pax-swissbox-bnd/1.8.1/pax-swissbox-bnd-1.8.1.jar
[ERROR] urls[57] = file:/home/jabong/.m2/repository/biz/aQute/bnd/bndlib/2.4.0/bndlib-2.4.0.jar
[ERROR] urls[58] = file:/home/jabong/.m2/repository/org/ops4j/pax/url/pax-url-commons/2.4.1/pax-url-commons-2.4.1.jar
[ERROR] urls[59] = file:/home/jabong/.m2/repository/org/ops4j/pax/swissbox/pax-swissbox-property/1.8.1/pax-swissbox-property-1.8.1.jar
[ERROR] urls[60] = file:/home/jabong/.m2/repository/org/ops4j/base/ops4j-base-util-property/1.5.0/ops4j-base-util-property-1.5.0.jar
[ERROR] urls[61] = file:/home/jabong/.m2/repository/org/ops4j/pax/url/pax-url-aether/2.4.1/pax-url-aether-2.4.1.jar
[ERROR] urls[62] = file:/home/jabong/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.12/jcl-over-slf4j-1.7.12.jar
[ERROR] urls[63] = file:/home/jabong/.m2/repository/org/ops4j/pax/url/pax-url-war/2.4.1/pax-url-war-2.4.1-uber.jar
[ERROR] urls[64] = file:/home/jabong/.m2/repository/org/ops4j/pax/swissbox/pax-swissbox-optional-jcl/1.8.1/pax-swissbox-optional-jcl-1.8.1.jar
[ERROR] urls[65] = file:/home/jabong/.m2/repository/org/apache/karaf/deployer/org.apache.karaf.deployer.spring/4.0.0/org.apache.karaf.deployer.spring-4.0.0.jar
[ERROR] urls[66] = file:/home/jabong/.m2/repository/org/apache/karaf/deployer/org.apache.karaf.deployer.blueprint/4.0.0/org.apache.karaf.deployer.blueprint-4.0.0.jar
[ERROR] urls[67] = file:/home/jabong/.m2/repository/org/apache/karaf/deployer/org.apache.karaf.deployer.features/4.0.0/org.apache.karaf.deployer.features-4.0.0.jar
[ERROR] urls[68] = file:/home/jabong/.m2/repository/org/apache/karaf/deployer/org.apache.karaf.deployer.kar/4.0.0/org.apache.karaf.deployer.kar-4.0.0.jar
[ERROR] urls[69] = file:/home/jabong/.m2/repository/org/apache/karaf/kar/org.apache.karaf.kar.core/4.0.0/org.apache.karaf.kar.core-4.0.0.jar
[ERROR] urls[70] = file:/home/jabong/.m2/repository/org/apache/karaf/shell/org.apache.karaf.shell.console/4.0.0/org.apache.karaf.shell.console-4.0.0.jar
[ERROR] urls[71] = file:/home/jabong/.m2/repository/jline/jline/2.12.1/jline-2.12.1.jar
[ERROR] urls[72] = file:/home/jabong/.m2/repository/org/apache/karaf/jaas/org.apache.karaf.jaas.modules/4.0.0/org.apache.karaf.jaas.modules-4.0.0.jar
[ERROR] urls[73] = file:/home/jabong/.m2/repository/org/apache/karaf/jaas/org.apache.karaf.jaas.config/4.0.0/org.apache.karaf.jaas.config-4.0.0.jar
[ERROR] urls[74] = file:/home/jabong/.m2/repository/org/apache/karaf/shell/org.apache.karaf.shell.core/4.0.0/org.apache.karaf.shell.core-4.0.0.jar
[ERROR] urls[75] = file:/home/jabong/.m2/repository/org/apache/sshd/sshd-core/0.14.0/sshd-core-0.14.0.jar
[ERROR] urls[76] = file:/home/jabong/.m2/repository/org/apache/commons/commons-compress/1.9/commons-compress-1.9.jar
[ERROR] urls[77] = file:/home/jabong/.m2/repository/org/osgi/org.osgi.core/6.0.0/org.osgi.core-6.0.0.jar
[ERROR] urls[78] = file:/home/jabong/.m2/repository/org/apache/xbean/xbean-finder-shaded/3.18/xbean-finder-shaded-3.18.jar
[ERROR] urls[79] = file:/home/jabong/.m2/repository/org/apache/xbean/xbean-asm5-shaded/3.18/xbean-asm5-shaded-3.18.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[project>com.jabong.orchestratorservice:basecomponent:1.0, parent: ClassRealm[maven.api, parent: null]]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
jabong#jabong1143:~/code/github.com/jabong/orchestrator-service/basecomponent$
Karaf version is reporting 3.0.5.
karaf#root>info
Karaf
Karaf version 3.0.5
Karaf home /home/jabong/Downloads/software/dev/apache-servicemix-6.1.0
Karaf base /home/jabong/Downloads/software/dev/apache-servicemix-6.1.0
Karaf etc /home/jabong/Downloads/software/dev/apache-servicemix-6.1.0/etc
OSGi Framework org.apache.felix.framework - 4.2.1
So tried karaf-maven-plugin with version 3.0.5. But still getting same error.
The error seems to be an issue with maven 3.0.4 that I was using as mentioned here. After upgrading maven to 3.2.5 I am not getting the issue.
I cannot tell what causes your exact problem, but there are several issues with your POM file:
You should not define a packaging type that is implemented in a bundle you only pull in if a certain profile is active.
The packaging type has to be bundle, not kar. Instead you trigger the creation of the feature descriptor and KAR artifact via the karaf plugin configuration.
The Karaf plugin version should match your Karaf version.
You should define the Camel version (better all versions of your dependencies) as a property in your POM so it can be re-used in several places.
Karaf ships with Camel. Instead of loading Camel bundles one by one through your generated feature file, driven by the POM, you can set the scope of all your Camel dependencies to provided and instead declare a feature dependency in a template feature.xml. This is more the KAR/feature way of doing things, but less the Maven way as your POM does not drive all your dependencies anymore. Your choice.
I suggest a POM along these lines:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>your-artifact</artifactId>
<packaging>bundle</packaging>
<properties>
<camel.version>2.16.1</camel.version>
<!-- ... -->
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<!-- Documentation at http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
</plugin>
<!-- Documentation at https://karaf.apache.org/manual/latest/developers-guide/karaf-maven-plugin.html -->
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<configuration>
<aggregateFeatures>false</aggregateFeatures>
<includeTransitiveDependency>true</includeTransitiveDependency>
</configuration>
<executions>
<execution>
<id>generate-karaf-artifacts</id>
<goals>
<goal>features-generate-descriptor</goal>
<goal>kar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${camel.version}</version>
<scope>provided</scope>
</dependency>
<!-- ... -->
</dependencies>
</project>
Create a template feature.xml in src/main/feature like so:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.3.0" name="your-feature-repo-name">
<feature name="${project.artifactId}" version="${project.version}" description="Describe your feature">
<feature version="${camel.version}">camel-jetty</feature>
<feature version="${camel.version}">camel-netty4-http</feature>
<!-- This is to pull in the bundle you built. -->
<bundle start-level="91">mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle>
</feature>
</features>
The template is picked up by the Karaf plugin and it adds the rest of your dependencies to this template. Check out the result after the build in target/feature/feature.xml and/or in the KAR artifact.

PlayN skeleton project html module can't find core module in maven?

Based on the PlayN Getting Started wiki page I created a skeleton project (called GuiPoc) in eclipse. I managed to make the guipoc-html project compile successfully (with Google -> GWT Compile), and eventually Run as -> Web Application. I tried using mvn gae:run from the guipoc/html directory (in cygwin) as per the wiki, and got the following output:
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building GuiPoc HTML 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-gae-plugin:0.9.2:run (default-cli) # guipoc-html >>>
[WARNING] The POM for com.mydomain.mynamespace:guipoc-core:jar:0.0.1-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.619s
[INFO] Finished at: Sun Jan 01 20:05:29 VET 2012
[INFO] Final Memory: 8M/121M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project guipoc-html: Could not resolve dependencies for project com.mydomain.mynamespace:guipoc-html:war:0.0.1-SNAPSHOT: Failure to find com.mydomain.mynamespace:guipoc-core:jar:0.0.1-SNAPSHOT in http://forplay.googlecode.com/svn/mavenrepo was cached in the local repository, resolution will not be reattempted until the update interval of forplay-legacy has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
Actual Question:
I don't understand why it's looking for the dependency in the system repository instead of the local directory. What am I doing wrong? Do I need to change something in my pom.xml files? Create a settings.xml in my C:\Users\MyName.m2 directory and set something there?
Here is the content of guipoc/html/pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.mydomain.mynamespace</groupId>
<artifactId>guipoc</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>guipoc-html</artifactId>
<packaging>war</packaging>
<name>GuiPoc HTML</name>
<properties>
<gwt.module>com.mydomain.mynamespace.GuiPoc</gwt.module>
<gwt.name>guipoc</gwt.name>
<!-- Desired Google App Engine SDK version -->
<gae.version>1.6.0</gae.version>
</properties>
<dependencies>
<dependency>
<groupId>com.mydomain.mynamespace</groupId>
<artifactId>guipoc-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.googlecode.playn</groupId>
<artifactId>playn-html</artifactId>
<version>${playn.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
<wtpversion>2.0</wtpversion>
<additionalBuildcommands>
<buildCommand>
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
</buildCommand>
</additionalBuildcommands>
<additionalProjectnatures>
<projectnature>com.google.gwt.eclipse.core.gwtNature</projectnature>
<projectnature>com.google.appengine.eclipse.core.gaeNature</projectnature>
</additionalProjectnatures>
</configuration>
</plugin>
<plugin>
<groupId>net.kindleit</groupId>
<artifactId>maven-gae-plugin</artifactId>
<version>0.9.2</version>
<dependencies>
<!--
Declare explicit dependency on gae-runtime here,
so we can specify the App Engine SDK version
-->
<dependency>
<groupId>net.kindleit</groupId>
<artifactId>gae-runtime</artifactId>
<version>${gae.version}</version>
<type>pom</type>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
Here is the content of guipoc/core/pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.mydomain.mynamespace</groupId>
<artifactId>guipoc</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>guipoc-core</artifactId>
<packaging>jar</packaging>
<name>GuiPoc Core</name>
<dependencies>
<dependency>
<groupId>com.googlecode.playn</groupId>
<artifactId>playn-core</artifactId>
<version>${playn.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
</plugins>
<resources>
<!-- include the source files in our main jar for use by GWT -->
<resource>
<directory>${project.build.sourceDirectory}</directory>
</resource>
<!-- and continue to include our standard resources -->
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
</resources>
</build>
</project>
Here is the content of guipoc/pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.googlecode.playn</groupId>
<artifactId>playn-project</artifactId>
<version>1.0.3</version>
</parent>
<groupId>com.mydomain.mynamespace</groupId>
<artifactId>guipoc</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>GuiPoc Metaproject</name>
<properties>
<playn.version>1.0.3</playn.version>
</properties>
<modules>
<module>core</module>
<module>java</module>
<module>html</module>
<module>android</module>
</modules>
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.6</version>
<scope>system</scope>
<systemPath>C:\Program Files\Java\jdk1.7.0_02\lib\tools.jar</systemPath>
</dependency>
</dependencies>
</project>
Unfortunately, Maven is not too smart about multimodule projects. A standard PlayN project (including yours) has the following module structure:
top
+- core
+- html (depends on core)
+- java (depends on core)
+- android, flash, etc.
When you are in the top directory, and you invoke Maven, it reads all of the submodule POMs and "knows" about all of them and will properly set up classpaths so that they see the appropriate classes directory when compiling and running.
But if you go into, say, the html directory and invoke Maven there, it no longer "knows" about all of the submodules. All it knows about is the html POM and when it sees a dependency for anything else (like the core module in this case) it goes through the standard dependency resolution process, which is:
Check the local Maven repository ~/.m2/repository.
Check the repositories explicitly specified in the POMs.
Check Maven Central.
When you have a situation where you want to run a command in one of your submodule projects, you have to arrange to do it from the top-level project. This is why testing from the command line involves running mvn test -P test-java or mvn test -P test-html from the top-level directory, rather than just cd-ing into the java or html directory and running mvn test.
Unfortunately, the tricks that we use to make it possible to test the Java or HTML submodule from the command line don't work with gae:run. So in this case, you have to work around Maven's limitations by first installing your project artifacts into your local Maven repository before invoking gae:run (and indeed, doing this every time you want to test using gae:run. This is accomplished like so:
cd top
mvn install
cd html
mvn gae:run
It would be great if Maven were smart enough to detect that it was being run in a submodule directory and automatically resolve sibling dependencies in the same way it would if you invoked Maven from the top-level project directory. Alas, smart is an adjective that's rarely applicable when talking about Maven.

Resources