unable to run cucumber test using maven build run configuration - eclipse

I am trying to run cucumber tests in eclipse using maven build as run configuration.
When i run the configuration, build is getting success but browser does not invoke. Hence the test is not running.
Tests are getting skipped, giving an info "Nothing to compile - all classes are up to date".
I am able to run the same test successfully by running the feature file as cucumber feature.
Please suggest me why tests are getting skipped. Also let me know the steps for running the cucumber test as maven build.
Below is the pom.xml that i am using.
Also i am using vm arguments as "-Dcucumber.Options=--format html:target/cucumber-html-report --tags #Runme"
<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>Maven.Project</groupId>
<artifactId>testMaven</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Maven.Project-v1-testMaven</name>
<properties>
<corporate.test.url>http://google.com</corporate.test.url>
<corporate.test.browser>Firefox</corporate.test.browser>
<corporate.selenium.url>http://localhost:8888/wd/hub</corporate.selenium.url>
</properties>
<dependencies>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.1.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.1.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.42.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-exec</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>test</id>
<properties>
<corporate.test.url>http://acc-about.hm.com</corporate.test.url>
<corporate.test.browser>Firefox</corporate.test.browser>
<corporate.selenium.url>http://localhost:8888/wd/hub</corporate.selenium.url>
</properties>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.10</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
</build>
</project>

Please remove the skiptests tag in your maven - surefire plugin...
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.10</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
EDIT:
please add the following lines in configuration
<suiteXmlFiles>
<suiteXmlFile>${basedir}${suiteFile}</suiteXmlFile>
</suiteXmlFiles>
<reportsDirectory>./test-output/archive/${timestamp}</reportsDirectory>
In here suiteXmlFile points to your xml file you are trying to run and reportsDirectory points to your output folder. In command line or if using eclipse in goal provide clean test -DsuiteFile=
Hope tthis would help.

Related

Missing parameter for pluginExecutionFilter eclipse jpbm 7.12 project

I have installed jbpm 7.12 server. I created an empty project in MySpace.
I cloned the proposed repo in jbpm-console (MySpace > Project name > Settings and cloned from the suggested URL in Global Settings).
I imported the project in Eclipse but when i do a project update (Maven > Update project), I got the following error
Errors occurred during the build.
Errors running builder 'Maven Project Builder' on project 'approvals'.
Missing parameter for pluginExecutionFilter. groupId, artifactId, versionRange and goals must be specificed, but found: groupId = 'org.kie'
artifactId = 'kie-maven-plugin'
versionRange = '7.12.0.Final'
goals = '[]'
Here my pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>net.alfasistemi.bpm</groupId>
<artifactId>approvals</artifactId>
<version>1.0.0</version>
<packaging>kjar</packaging>
<name>approvals</name>
<description></description>
<dependencies>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-internal</artifactId>
<version>7.12.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.optaplanner</groupId>
<artifactId>optaplanner-core</artifactId>
<version>7.12.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.optaplanner</groupId>
<artifactId>optaplanner-persistence-jaxb</artifactId>
<version>7.12.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
<version>7.12.0.Final</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.kie</groupId>
<artifactId>kie-maven-plugin</artifactId>
<version>7.12.0.Final</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
How can I fix this problem?
I have the same problem in Eclipse. I have reverted back to 7.9.0-Final for just the kjar build plugin: kie-maven-plugin. You can still use 7.12.0-Final in the rest of the dependencies.
Add the following plugin management to the build section in pom.xml
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.kie</groupId>
<artifactId>kie-maven-plugin</artifactId>
<versionRange>[7.12.0,)</versionRange>
<goals>
<goal>build</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>

Deployment assembly of a Maven's Springboot project in Eclipse

Trying to deploy a SpringBoot Maven project on my Tomcat in Eclipse.
First problem: the lib directory is empty after deployment, Maven is not doing the job although the dependencies are in the Build Path.
First solution: i added manually my Maven's dependencies to the deployment structure in Property > Deployment Assembly, and this worked fine.
Second problem: each and everytime i update my Maven's project, the Deployment Assembly goes back to the original state (no Maven's dependencies in WAR) and again i have to do the job manually.
Tried everything i could, everything i've found here, still not working.
My 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>***</groupId>
<artifactId>***</artifactId>
<version>***</version>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.2.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>***</finalName>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.1</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
My Eclipse Maven plugin installation just in case:
Found the answer here.
I did not have m2e-wtp plugin installed, this fixed my problem.

Jersey REST API returning 404 not found deployed in tomcat

I have developed REST API through JAX-RS Jersey in Eclipse.
In Eclipse,i have configured Tomcat 8.0.21 server.
In Eclipse, i do Run As -> Run on Server, Tomcat Server runs successfully, and i able to hit the end points and getting proper response.
So far so good.
Next step,
Using Eclipse, i did export the project as WAR File.
Unzipped the Tomcat server to a directory in windows
Copied the WAR file in webapps directory
Copied the necessary jars to lib folder
Below are jars i copied to lib folder
jersey-container-servlet-core-2.23.1.
jar jersey-server-2.23.1.jar
java-client-2.3.1.jar
jersey-media-moxy-2.23.1.jar
gson-2.7.jar
Clicked on startup.bat in bin.
I can see - my war is deployed successfully and
server is running successfully.
However, when i try hit the same endpoint, i get 404 not found.
Please help, What Am i missing
This is how my pom.xml looks
<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>ecom.subhash</groupId>
<artifactId>couchdb</artifactId>
<packaging>war</packaging>
<version>0.0.2-SNAPSHOT</version>
<name>couchdb</name>
<build>
<finalName>couchdb</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<inherited>true</inherited>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.6</version>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>ecom.subhash.couchdb.resource.App</Main-Class>
</manifestEntries>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>${jersey.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<!-- use the following artifactId if you don't need servlet 2.x compatibility -->
<!-- artifactId>jersey-container-servlet</artifactId -->
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-moxy</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>com.couchbase.client</groupId>
<artifactId>java-client</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>9.2.3.v20140905</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>9.2.3.v20140905</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>2.23.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-jetty-http</artifactId>
</dependency>
</dependencies>
<properties>
<jersey.version>2.23.1</jersey.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Maven tomcat plugin does not allow stepping into dependent jars

I am using the Maven Tomcat plugin to test a Maven webservice project using Hibernate.
My POM looks like this:
<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.honeywell.gt</groupId>
<artifactId>WSOCCMeoReports</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Simple CXF project using spring configuration</name>
<description>Simple CXF project using spring configuration</description>
<properties>
<shiro.version>1.2.1</shiro.version>
<spring.version>3.1.2.RELEASE</spring.version>
<cxf.version>2.6.1</cxf.version>
<hibernate.version>3.6.5.Final</hibernate.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
<!--
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>${hibernate.version}</version>
</dependency> -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.6</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-web</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>com.sybase.jdbc</groupId>
<artifactId>SybDriver</artifactId>
<version>3.0.0</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<!-- mvn clean install tomcat:run-war to deploy
Look for "Running war on http://xxx" and
"Setting the server's publish address to be /yyy"
in console output; WSDL browser address will be
concatenation of the two: http://xxx/yyy?wsdl
-->
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<executions>
<execution>
<id>start-tomcat</id>
<goals>
<goal>run-war</goal>
</goals>
<phase>pre-integration-test</phase>
<configuration>
<port>${test.server.port}</port>
<path>/webservice</path>
<fork>true</fork>
<useSeparateTomcatClassLoader>true</useSeparateTomcatClassLoader>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<projectNameTemplate>[artifactId]-[version]</projectNameTemplate>
<wtpmanifest>true</wtpmanifest>
<wtpapplicationxml>true</wtpapplicationxml>
<wtpversion>2.0</wtpversion>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
The Debug goals are tomcat:run-war
After hitting a break point in the service I cannot step into third party dependencies such as Hibernate. However, if I run a Unit test from the same Maven web service project, I can step into Hibernate.
EDIT 1:
I ran into this and got some ideas about attaching source. Matter of fact, I am trying to debug Hibernate, so I edited source lookup and added paths to the following external archives in my .m2 repository:
hibernate-entitymanager-3.6.5.Final
hibernate-core-3.6.5.Final.
Saved changes and Eclipse still cannot find source to step into. Anyone out there?
Problem appears to be a know issue with Maven Plugin for Eclipse as indicated here.
This post was helpful but I found out that for hibernate 3.6.5, I had to add hibernate-core-3.6.5.Final-sources.jar to source lookup path instead of hibernate-core-3.6.5.Final.jar.

Maven in Eclipse: Incremental Builds

I've been looking around for a while and can't find a definite method to build Maven incrementally in Eclipse.
Currently Maven produces a .war file each time I make a change, which takes some time to compile during the the regular build process.
What's the easiest method to speed things up and just copy across the delta changes into a directory instead?
My pom.xml file:
<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.mkyong.common</groupId>
<artifactId>SpringMVC</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>SpringMVC Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<spring.version>3.1.2.RELEASE</spring.version>
</properties>
<dependencies>
<!-- Spring 3 dependencies -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- JSON -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.8</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.8</version>
</dependency>
<!-- DHTMLX -->
<dependency>
<groupId>com.mylaensys.dhtmlx.adapter</groupId>
<artifactId>mylaensys-dhtmlx-adapter</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
<build>
<finalName>SpringMVC</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.2</version>
<!-- <version>2.1-beta-1</version> -->
<configuration>
<overlay>
<excludes>
META-INF/**,scripts/menu.js,WEB-INF/*.txt,WEB-INF/jboss-web.xml,WEB-INF/web.xml
</excludes>
</overlay>
<archiveClasses>true</archiveClasses>
<warSourceDirectory>
src/main/webapp
</warSourceDirectory>
<warSourceExcludes>
WEB-INF/*.tld,WEB-INF/classes/**
</warSourceExcludes>
<outputDirectory>
${env.WAR_PATH}
</outputDirectory>
<archive>
<manifest>
<addClasspath>false</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
<addMavenDescriptor>true</addMavenDescriptor>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
My way using system's maven (not eclipse's internal maven):
Right-Click to the project -> Preferences -> Builders
New ... -> Program
Set C:\Program Files\apache-maven-3.3.9\bin\mvn.cmd (your directory may be different) to Location.
Set the folder where you have your pom.xml in to "Working Directory:"
Set war:war to Arguments:.
Switch to panel "Build Options" and check "During auto builds".
Now, if you ever change a file (and save) the mvn war:war is executed.