Allure reports folder created but no report seen in the folder - allure

I have added the required dependencies in my POM.xml and also added the required plugin in the runner class. But when I run, I see that the allure reports folder is created and it has a json file. I don't see the html report generated. Am I missing something here? My plugin code is below.
plugin = { "pretty", "html:target/cucumber-html-reports", "io.qameta.allure.cucumberjvm.AllureCucumberJvm",
"json:target/cucumber-html-reports/cucumber.json"}
Ideally there should be a html report which is generated.
Below is the part of pom.xml for the surefire reports
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
-Dcucumber.options="--plugin io.qameta.allure.cucumberjvm.AllureCucumberJvm"
</argLine>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>

Related

Maven default compile not picking up custom plugin goal

I have written a custom plugin, then I installed it. Then I modified the pom.xml of the project from which I want to use the custom plugin. When I invoke my plugin goal directly the plugin goal is executed successfully, but when I try to mvn compile my custom plugin goal is not executed. What might be the reason?
My plugin's pom.xml:
<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>
<groupId>com.xxx.plugins.maven</groupId>
<artifactId>datanucleus-enhance-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>Datanucleus-enhance Maven Plugin</name>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.2</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
My project using custom plugin I added following:
<!-- enhance JDO classes -->
<plugin>
<groupId>com.sukantu.plugins.maven</groupId>
<artifactId>datanucleus-enhance-maven-plugin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<configuration>
<jdoClassDirList>
<param>target/${project.artifactId}-${project.version}/WEB-INF/classes/</param>
</jdoClassDirList>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
</plugin>
I followed section Attaching the Mojo to the Build Lifecycle from maven guide site: https://maven.apache.org/guides/plugin/guide-java-plugin-development.html
The following command successfully calls my plugin goal:
mvn com.xxx.plugins.maven:datanucleus-enhance-maven-plugin:enhance
The following command does NOT successfully call my plugin goal:
mvn compile
Thanks for any inputs!
I came across this link:
How do I link a plugin execution to a phase in maven without forcing me to specify plugin on command line
So I removed <pluginManagement> tags so <plugins> appear directly under '<build>'. Then I tried 'mvn compile' from command line and it successfully called my custom plugin goal!
But when I checked pom.xml in Eclipse I saw another error referenced here How to solve “Plugin execution not covered by lifecycle configuration” .
Since the command line is working correctly, I think this is m2e Eclipse plugin error and so I have disabled the marked by going to 'Eclipse' -> 'Window' -> 'Show View' -> 'Markers' -> right click that marker -> 'Delete'. Now Eclipse is not showing any error and command line is also working as expected. Hope this helps someone else.

Bad request when updating Appengine with mvn appengine:update

i'm getting the following error, when I try to update a appengine-application with the appengine-maven-plugin:
400 Bad Request
Error when loading application configuration:
Unable to assign value '1.8.3' to attribute 'version':
Value '1.8.3' for version does not match expression '^(?:^(?!-)[a-z\d\-]{0,62}[a-z\d]$)$'
This is confusing to my because my appengine-web.xml looks like follows:
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>helloworld</application>
<version>0-0-1</version>
<threadsafe>true</threadsafe>
<precompilation-enabled>false</precompilation-enabled>
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
</appengine-web-app>
I'm wondering why appengine-maven-plugin wants to use 1.8.3 as application-version. 1.8.3 is the version of appengine-sdk i want to use.
In my POM it's configured as follows:
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>${appengine.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
and later on
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.version}</version>
<configuration>
<appVersion>${appengine.app.version}</appVersion>
</configuration>
</plugin>
${appengine.app.version} points to 1.8.3
I'm using Maven in Version 3.1 and Java 1.7.0_25
What do I wrong? Can anyone help my?
Thanks a lot
I had the same issue as you described. When I added the "version" element in the configuration element, with value pointing to the version of the app in my appengine-web.xml file, mvn appengine:update completed successfully. (maven v3.1.0, appengine plugin v1.8.3)
in pom.xml:
....
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.version}</version>
<configuration>
<version>MY-VERSION</version>
</configuration>
</plugin>
...
in appengine-web.xml:
...
<version>MY-VERSION</version>
...
If you generated the project with the archetype skeleton, like I did, and you have a block similar to
<properties>
<app.id>MY-GAE-PROJECT-ID</app.id>
<app.version>1</app.version>
<appengine.version>1.9.20</appengine.version>
<gcloud.plugin.version>0.9.58.v20150505</gcloud.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
in your pom.xml and your appengine-web.xml looked like
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>${app.id}</application>
<version>1</version>
etc....
when it got made, then, modify appengine-web.xml to be ${app.version} because they so helpfully already added that property with the archetype but never used it anywhere. Then, update your pom.xml's app.version to be your appropriate version (if you don't use "1"). Then, scroll down in the pom.xml to where you see
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.version}</version>
<configuration>
<enableJarClasses>false</enableJarClasses>
and inside the configuration block there add
<version>${app.version}</version>
Try to change appengine-web.xml entry from <version>0-0-1</version> to <version>1</version>. Regards, Adam.
In changed only the pom.xml file by adding the plugin>configuration>version tag (per below)...
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${project.appengine.version}</version>
<configuration>
<port>8888</port>
*<version>${app.version}</version>*
</configuration>
</plugin>
The way I solved this issue was trivial in my console I executed mvn clean install and then the appcfg.cmd -A [your app] update target\appengine-try-java-1.0 command.

GWT + Appengine + JPA + Eclipse + Maven: How to get them to work together

I have a project where I want to use the eclipse GWT tools (dev mode and debugger) to interact with the GWT/Appengine/Maven application I am writing. I have things in a somewhat working order but there are still a few things around the edges I don't have right. I will post the POM file if anyone could help me with these few issues.
When I do a Maven->Update Project, I loose the appengine nature in the eclipse project properties and have to go to Properties, Google, AppEngine and recheck Use Google App Engine. Is there something I can do in the POM where I don't loose the appengine nature? I'm using the Google appengine-maven-plugin plugin. That seems to be the official one to use.
After a maven build, I have to do a project clean to get the jpa classes enhanced before I can run them with the Run As - Web Application launcher. The maven build has test cases for the domain objects that work within the build - and I see the classes being enhance with this goal in the build 'maven-datanucleus-plugin:3.1.3:enhance (default)'. But running as a Web Application it throws out errors telling me the classes are not enhanced unless I do a project clean which cause eclipse to do it's enhance. Is there a way to avoid this extra step?
I can not run the JUnit View test runner or use a launcher that uses that view. The JUnit View complains that: "Caused by: org.datanucleus.exceptions.NucleusException: Plugin (Bundle) "org.datanucleus" is already registered. Ensure you dont have multiple JAR versions of the same plugin in the classpath. The URL "file:/C:/Users/bondsd/.m2/repository/org/datanucleus/datanucleus-core/3.1.3/datanucleus-core-3.1.3.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/C:/Program%20Files/eclipse/plugins/com.google.appengine.eclipse.sdkbundle_1.7.5/appengine-java-sdk-1.7.5/lib/opt/user/datanucleus/v2/datanucleus-core-3.1.3.jar."". I have tried various things, such as removing the datanucleus plugin and/or dependencies, various configuration options, and unchecking the 'Use Datnucleus JDO/JPA to access the datastore' in the app engine properties panel. Is there a way to get this to work?
Below is the POM I used with the company and project name x'ed out. If you need the launchers I will be glad to post them too. Thanks in advance for any advice or help on this. I have searched the internet and haven't found the right solution yet.
<modelVersion>4.0.0</modelVersion>
<groupId>com.xxx.xxxx</groupId>
<artifactId>shell</artifactId>
<packaging>war</packaging>
<version>0.1.0-proto</version>
<name>XXXXXX</name>
<description>A XXXXXXXX</description>
<properties>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- GWT version -->
<gwt.version>2.5.1</gwt.version>
<gwt.style>PRETTY</gwt.style>
<!-- GAE version -->
<appengine.version>1.7.6</appengine.version>
<appengine.sdk.version>1.7.6</appengine.sdk.version>
<appengine.orm.version>2.1.2</appengine.orm.version>
<appengine.port>8888</appengine.port>
<datanucleus.core.version>3.1.3</datanucleus.core.version>
<datanucleus.api.version>3.1.3</datanucleus.api.version>
<datanucleus.enhancer.version>3.1.1</datanucleus.enhancer.version>
<datanucleus.plugin.version>3.1.3</datanucleus.plugin.version>
<slf4jVersion>1.6.6</slf4jVersion>
<log4j.version>1.3</log4j.version>
<junit.version>4.11</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>com.google.gwt.inject</groupId>
<artifactId>gin</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-servlet</artifactId>
<version>3.0</version>
</dependency>
<!-- GWT dependencies -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<!-- GAE SDK -->
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>${appengine.version}</version>
</dependency>
<!-- For the servlet filter -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<!-- <dependency> <groupId>jstl</groupId> <artifactId>jstl</artifactId>
<version>1.2</version> </dependency> -->
<!-- RequestFactory server -->
<dependency>
<groupId>com.trycatchsoft.gwt.requestfactory</groupId>
<artifactId>injected-requestfactory</artifactId>
<version>1.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.web.bindery</groupId>
<artifactId>requestfactory-server</artifactId>
<version>${gwt.version}</version>
</dependency>
<dependency>
<groupId>com.google.web.bindery</groupId>
<artifactId>requestfactory-apt</artifactId>
<version>${gwt.version}</version>
</dependency>
<!-- RequestFactory will use JSR 303 javax.validation -->
<!-- Validation API -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
</dependency>
<!-- Validation Implementation -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.3.0.Final</version>
</dependency>
<!--Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.0</version>
<scope>test</scope>
</dependency>
<!-- GAE libraries for local testing as described here: http://code.google.com/appengine/docs/java/howto/unittesting.html -->
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-labs</artifactId>
<version>${appengine.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-stubs</artifactId>
<version>${appengine.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-testing</artifactId>
<version>${appengine.version}</version>
<scope>test</scope>
</dependency>
<!-- End of Test Dependencies -->
<!-- JPA 2.0 for GAE -->
<dependency>
<groupId>com.google.appengine.orm</groupId>
<artifactId>datanucleus-appengine</artifactId>
<version>${appengine.orm.version}</version>
</dependency>
<!-- Datanucleus -->
<!-- datanucleus-core is not needed for compilation. in fact, it cannot
have compile scope because the datanucleus plugin automatically adds it during
enhancement and complains if there are two copies. app should not depend
on any classes in this lib anyways. -->
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>${datanucleus.core.version}</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>javax.transaction</groupId>
<artifactId>transaction-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- datanucleus-jpa is needed during compilation for its #Extension annotation
which is used throughout entity classes -->
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jpa</artifactId>
<version>${datanucleus.api.version}</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jpa_2.0_spec</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.2</version>
</dependency>
<!-- SLF4J logging libraries -->
<!-- <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId>
<version>${slf4jVersion}</version> </dependency> <dependency> <groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId> <version>1.7.2</version> </dependency>
<dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.16</version>
</dependency> -->
<!-- End SLF4J logging libraries -->
</dependencies>
<build>
<!-- Generate compiled stuff in the folder used for developing mode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
<dependencies>
<!-- Need to run the RF Validation tool. This works on both the command-line
and in Eclipse, provided that m2e-apt is installed. -->
<dependency>
<groupId>com.google.web.bindery</groupId>
<artifactId>requestfactory-apt</artifactId>
<version>${gwt.version}</version>
</dependency>
</dependencies>
</plugin>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.5.1-rc1</version>
<dependencies>
<!-- Force plugin to use same gwt version -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwt.version}</version>
</dependency>
</dependencies>
<configuration>
<strict>true</strict>
<extraJvmArgs>-Xss1024K -Xmx1024M -XX:MaxPermSize=256M</extraJvmArgs>
<logLevel>INFO</logLevel>
<style>${gwt.style}</style>
<copyWebapp>true</copyWebapp>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<runTarget>Shell.html</runTarget>
<webappDirectory>${webappDirectory}</webappDirectory>
<module>com.ihg.dashboard.Shell</module>
<server>com.google.appengine.tools.development.gwt.AppEngineLauncher</server>
<i18nMessagesBundle>com.ihg.dashboard.client.Messages</i18nMessagesBundle>
<appEngineVersion>${appengine.version}</appEngineVersion>
<!-- Should GWT create the Story of Your Compile Report -->
<compileReport>false</compileReport>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
<goal>i18n</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.version}</version>
<configuration>
<jvmFlags>
<jvmFlag>-Ddatastore.backing_store=${project.basedir}\local_db.bin</jvmFlag>
</jvmFlags>
<enhancerApi>JPA</enhancerApi>
</configuration>
</plugin>
<!-- This plug-in "enhances" your domain model objects (i.e. makes them
persistent for datanucleus) -->
<!-- Might not need this, appengine is supposed to do this appengine:enhance -->
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>maven-datanucleus-plugin</artifactId>
<version>${datanucleus.plugin.version}</version>
<configuration>
<mappingIncludes>**/domain/*.class</mappingIncludes>
<metadataIncludes>**/domain/*.class</metadataIncludes>
<verbose>false</verbose>
<enhancerName>ASM</enhancerName>
<api>JPA</api>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<!-- enhancement requires the gwt-user jar because many of the entity
classes implement IsSerializable and the enhancer needs it on the classpath
to function. because the gwt-user library has a scope of provided, it is
only available on the compilation and test classpath, and is not transitive
to the enhancement classpath. -->
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
</dependency>
<dependency>
<!-- force maven-datanucleus-plugin to use the same version of datanucleus-core -->
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>${datanucleus.core.version}</version>
</dependency>
</dependencies>
</plugin>
<!-- Copy static web files before executing gwt:run -->
<!-- May not need this now -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
<configuration>
<webXml>${webappDirectory}/WEB-INF/web.xml</webXml>
<webappDirectory>${webappDirectory}</webappDirectory>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>
gwt-maven-plugin
</artifactId>
<versionRange>
[2.5.1-rc1,)
</versionRange>
<goals>
<goal>i18n</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.datanucleus
</groupId>
<artifactId>
maven-datanucleus-plugin
</artifactId>
<versionRange>
${datanucleusVersion}
</versionRange>
<goals>
<goal>enhance</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
=======================================
On Edit: Here is a solution to bullet point 3. Disable the JPA/JDO in the Project Properties - Google - App Engine page. Go to the build path and remove all the datanucleus libraries that are listed as top level libraries (these are put there by enabled the appengine in the project properties). Make sure the Maven dependencies are at the bottom of the list on the Order Tab.
On Edit 2: I found a way to keep the GAE project nature when I do a Maven->Update Project. I added this to the POM (even though I am using an eclipse build with m2e installed)
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.7</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>
This addresses Bullet point 1. So now I have points 1 and 3 solved (kind of). I still need a way to address bullet point 2, although the work around is easy if I remember to do it. I am more worried about the people who get the code after me remembering to do it.
I am also looking for a way to not use the eclipse launcher at all. I know it can be done with adding various profiles and configs. I just need to find the right configs to do that. By this, I mean a profile that will run the gwt code in dev mode (or super-dev mode) and also a profile that will run the debugger with the gwt code in dev mode.
On Edit 3: I solved bullet point 2. It was as simple as turning off Project->Build Automatically. I'm not sure what that was on in the first place.
That is all 3 bullet points solved. At this point I probably should create an answer for the question and mark it solved for those that are interested in this and didn't read down this far. I will do that in a day or two (when I have the time to compose a nice answer).
It looks like your maven setup is good, but let me make some observations that may help.
1) I would remove the enhancerApi from the appengine-maven-plugin as we're just executing the same thing as the maven-datanucleus-plugin. As a result, don't run the appengine:enhance goal along with the datanucleus plugin's goals.
2) The datanucleus plugin is setup only to enhance domain classes, which sounds right to me, but just verify this I guess.
3) I'm not the best with eclipse anymore, but I'm curious which maven plugin you are using, the m2eclipse plugin is developed by sonatype and the most accurate one in my opinion.
4) The execution of the war plugin on compile seems wrong to me, as this should default to the package phase anyway, which ensures other phases have properly executed beforehand.
5) You may need to get set up a few more execute directives for the plugins, or rely on defaults if they exist. The maven lifecycle can be a bit tricky, and I would recommend reading up on http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html and making sure eclipse is running the correct phases before launching your application.

Maven Cobertura plugin not generating coverage.xml

I am trying to generate a coverage.xml so that I can reference it in Cobertura plugin of Hudson, but the file is not being created.
I've added the following to my POM
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
</configuration>
</plugin>
</plugins>
</reporting>
After running mvn cobertura:cobertura, the HTML site is generated as expected at **\target\site\cobertura, but coverage.xml is nowhere to be found. What am I missing/misunderstanding?
I am running Maven 3.0.3
Add below lines to your application Goals:(configure section of the application in jenkins)
cobertura:cobertura -Dcobertura.report.format=xml
pom.xml changes:
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.6</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
</configuration>
</plugin>
</plugins>
I put the plugin in the build section and it works:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
</configuration>
</plugin>
</plugins>
</build>
The reporting section and its differences to the plugin section are described here. I don't know if this is a maven [3.0.4] or cobertura-plugin issue.
I'm still quite a novice with the connections between Maven Plugins and Hudson and it's plugins - so this isn't an intelligent answer by any means, but help on Google is very few and far between for this issue - so hopefully it helps someone in the future.
After spending a few more hours of tinkering with settings, I've found that the coverage.xml simply doesn't seem to be built locally.
This is the combination that got it working:
I had changed my version to 2.2 in my POM (I was getting resource
not found errors from Apache with 2.5.1)
Added cobertura:cobertura in my Hudson goal
Set the Cobertura coverage pattern to the
recommended **/target/site/cobertura/coverage.xml
My objective was to get Cobertura to run duing mvn test with no additional command line parameters. Here's the magic XML that did the trick for me, with both the HTML and XML being generated in /target/site/cobertura.
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>cobertura</id>
<phase>test</phase>
<goals>
<goal>cobertura</goal>
</goals>
<configuration>
<formats>
<format>xml</format>
<format>html</format>
</formats>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
I had the same issue but it's resolved right now:
Just add -Dcobertura.report.format=xml after your maven command. It should work
I have the same issue using 2.6 of the plugin.
I found that when I specify both types, I only got html.
<formats>
<format>html</format>
<format>xml</format>
</formats>
But when I specify only xml, I get an xml report.
<formats>
<format>xml</format>
</formats>
This is probably a bug in the plugin.
Another user suggested creating two executions. I tried that with no success (meaning I got html, but not xml).
Update your POM file as
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
</configuration>
</plugin>
</plugins>
This worked out for me: Probable reason it contanis the latest version of cobertura-maven-plugin (2.7)
The are two ways to integrate Cobertura into Maven.
Put Cobertura into the build section of the pom file, then you have to execute mvn clean cobertura:cobertura to generate the reports. If you have XML and HTML configured, then you get both reports.
Put Cobertura into the reporting section of the pom file, then you have to execute mvn clean site to generate the reports. If you have XML and HTML configured, then you get both reports. Additionally you get a generated site (open target/site/index.html) with all reports integrated e.g. Coberture, Checkstyle, ...

Conflicting versions of datanucleus enhancer in a maven google app engine project

I'm having a problem setting up datanucleus enhancer to use with a google app engine project. If I use the datanucleus eclipse plugin everything goes well, but in my maven project I get a strange conflicting version error.
My POM has these datanucleus references:
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>1.1.0</version>
</dependency>
...
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>maven-datanucleus-plugin</artifactId>
<version>1.1.0</version>
<configuration>
<mappingIncludes>**/*.class</mappingIncludes>
<verbose>true</verbose>
<enhancerName>ASM</enhancerName>
<api>JDO</api>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
</plugin>
When I try to build the project I get the following error:
Exception in thread "main" Plugin (Bundle) "org.datanucleus" is already registered.
Ensure you dont have multiple JAR versions of the same plugin in the classpath. The URL "file:/Users/drome/.m2/repository/org/datanucleus/datanucleus-core/1.1.0/**datanucleus-core-1.1.0.jar**" is already registered, and you are trying to register an identical plugin located at URL "file:/Users/drome/.m2/repository/org/datanucleus/datanucleus-core/1.1.3/**datanucleus-core-1.1.3.jar**."
org.datanucleus.exceptions.NucleusException: Plugin (Bundle) "org.datanucleus" is already registered. Ensure you dont have multiple JAR versions of the same plugin in the classpath. The URL "file:/Users/drome/.m2/repository/org/datanucleus/datanucleus-core/1.1.0/datanucleus-core-1.1.0.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/Users/drome/.m2/repository/org/datanucleus/datanucleus-core/1.1.3/datanucleus-core-1.1.3.jar."
at org.datanucleus.plugin.NonManagedPluginRegistry.registerBundle(NonManagedPluginRegistry.java:437)
at org.datanucleus.plugin.NonManagedPluginRegistry.registerBundle(NonManagedPluginRegistry.java:343)
at org.datanucleus.plugin.NonManagedPluginRegistry.registerExtensions(NonManagedPluginRegistry.java:227
)
at org.datanucleus.plugin.NonManagedPluginRegistry.registerExtensionPoints(NonManagedPluginRegistry.jav
a:159)
at org.datanucleus.plugin.PluginManager.registerExtensionPoints(PluginManager.java:82)
at org.datanucleus.OMFContext.(OMFContext.java:164)
at org.datanucleus.enhancer.DataNucleusEnhancer.(DataNucleusEnhancer.java:171)
at org.datanucleus.enhancer.DataNucleusEnhancer.(DataNucleusEnhancer.java:149)
at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1157)
I don't understand why datanucleus required maven to download datanucleus-core-1.1.3.jar since this is not referenced in the pom.xml
I also do not understand why datanucleus-core-1.1.3.jar is being registered...
Any ideas?
Thanks in advance...
The DN M2 plugin pulls in the latest versions of the available DN jars that it needs to do its job (there is no other sensible way to do it other than use the latest). You want to restrict "core" to a different version, either by specifying the plugin dependency of core, or by specifying that in your application to
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>1.1.0</version>
<scope>runtime</scope>
</dependency>
Unfortunately the answer is "hidden" in the comments:
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>1.1.0</version>
<scope>runtime</scope>
</dependency>
That worked for me!
I ran into the same issue while testing a maven gae plugin archetype.
I fixed it by adding exclusions in my gae runtime transitive dependencies
<!-- Google App Engine meta-package -->
<dependency>
<groupId>net.kindleit</groupId>
<artifactId>gae-runtime</artifactId>
<version>${gae.version}</version>
<type>pom</type>
<exclusions>
<exclusion>
<groupId>com.google.appengine.orm</groupId>
<artifactId>datanucleus-core</artifactId>
</exclusion>
</exclusions>
</dependency>
and then adding the nucleus core as a runtime dependency
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>${datanucleus-core.version}</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>javax.transaction</groupId>
<artifactId>transaction-api</artifactId>
</exclusion>
</exclusions>
</dependency>
as keeping the gae plugin section simple:
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>maven-datanucleus-plugin</artifactId>
<version>${maven-datanucleus-plugin.version}</version>
<configuration>
<!--
Make sure this path contains your persistent classes!
-->
<mappingIncludes>**/model/*.class</mappingIncludes>
<verbose>true</verbose>
<enhancerName>ASM</enhancerName>
<api>JDO</api>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
</plugin>
After reading "How to override a plugin's dependency in Maven", I found another way to fix this. Here is my POM:
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>maven-datanucleus-plugin</artifactId>
<version>3.1.0-m3</version>
<configuration>
<verbose>true</verbose>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>3.0.4</version>
</dependency>
</dependencies>
</plugin>
clearing your old version of datanucleus from your local maven repository also solving the problem.
Maven-datanucleus-plugin has stopped pulling in the latest versions of the available datanucleus-core since version 3.1.1.
Check the differences between the POM files for Maven-datanucleus-plugin 3.1.1 (http://repo1.maven.org/maven2/org/datanucleus/maven-datanucleus-plugin/3.1.1/maven-datanucleus-plugin-3.1.1.pom) and 3.1.0-release (http://mvnrepository.com/artifact/org.datanucleus/maven-datanucleus-plugin/3.1.0-release).
For maven-datanucleus-plugin 3.1.1 the version range of datanucleus-core dependency is (3.0.99, 3.1.99), and for maven-datanucleus-plugin 3.1.0-release it is (3.0.99, ). No wonder for the older versions of maven-datanucleus-plugin, it automatically pulls in the latest versions of datanucleus-core.

Resources