[Cucumber][JVM][Maven]Tests dosen't run from command line through maven - maven

I am running tests using java, cucumber with Maven.
I am using Eclipse IDE. Also the pom.xml has cucumber dependencies.
I am running tests in two ways.
From Eclipse IDE: I run tests as Junit tests and the test results are successful.
2: From command promt: My test failed and below is the result.
Here is the Pom.xml:
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
<groupId>CCIRA_Test_Auto</groupId>
<artifactId>CCIRA_Test_Auto</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>
<name>CCIRA_Test_Auto</name>
<properties>
<cucumber.version>1.2.0</cucumber.version>
<picocontainer.version>2.15</picocontainer.version>
</properties>
<dependencies>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.5</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-testng</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>phantomjsdriver</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.44.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.11-beta3</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.8.0</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
My Runner Test:
package ccira.helpers;
import org.junit.runner.RunWith;
import org.testng.annotations.Test;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
#RunWith(Cucumber.class)
#CucumberOptions(
features = "C:/Users/rah/Documents/workspace/CCIRA_auto/src/ressouces/features",
tags = {"#Personne"},
glue={"ccira.stepDefinitions"},
plugin ={
"pretty",
"html:results/cucumber",
"json:results/cucumber.json",
"junit:results/cucumber.xml",
}
)
public class RunnerTest {
}
My output console :
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building CCIRA_Test_Auto 0.0.1
[INFO] ------------------------------------------------------------------------
[WARNING] The artifact xml-apis:xml-apis:jar:2.0.2 has been relocated to xml-apis:xml-apis:jar:1.0.b2
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # CCIRA_Test_Auto ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\rah\Documents\workspace\CCIRA_Test_Auto\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # CCIRA_Test_Auto ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) # CCIRA_Test_Auto ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\rah\Documents\workspace\CCIRA_Test_Auto\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # CCIRA_Test_Auto ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) # CCIRA_Test_Auto ---
[INFO] Surefire report directory: C:\Users\rah\Documents\workspace\CCIRA_Test_Auto\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.051s
[INFO] Finished at: Mon Dec 05 09:30:10 GMT 2016
[INFO] Final Memory: 7M/62M
[INFO] ------------------------------------------------------------------------

The dependency
org.slf4j.impl.StaticLoggerBinder
is not defined in your pom.xml file. However it is defined on your build path in your Eclipse project. Placing one (and only one) of slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar on the class path should solve the problem.
I would add a dependency in your pom.xml, perhaps something like this:
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.21</version>
</dependency>
EDIT
A less good but viable alternative is to utilize the Surefire plugin's additionalClasspathElements element "to add custom resources/JARs to your classpath. This will be treated as an absolute file system path, so you may want use ${basedir} or another property combined with a relative path. Note that additional classpath elements are added to the end of the classpath, so you cannot use these to override project dependencies or resources."
I said less good because it is better to track as dependencies in your pom.xml where if you update one dependency to a later version you can see the other dependencies that also have to be updated. You might overlook jars specified down in the surefire plugin.

Try to run using the below command from command prompt
mvn clean test -Dcucumber.options="src/resources/features --tags ##Personne"

Related

Maven project cucumber test builded but result is 0

When i use this command in terminal mvn test -Dcucumberoptions="--tags #Smoke my test result is 0 all the time. Here is my pom, test runner and feature classes;
pom.xml
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<aspectj.version>1.8.10</aspectj.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>4.4.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>4.3.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.0.0-rc-2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>7.5.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-junit -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>7.5.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.qameta.allure/allure-junit5 -->
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-junit5</artifactId>
<version>2.13.6</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20160212</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.rest-assured/json-schema-validator -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>json-schema-validator</artifactId>
<version>4.3.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.9.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<includes>
**/TestRunner*.java
</includes>
</configuration>
</plugin>
</plugins>
</build>
</project>
TestRunner class for cucumber options
package cucumberOptions;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
#RunWith(Cucumber.class)
#CucumberOptions(
features = "src/test/java/features",
glue = {"Steps"}
)
public class TestRunner {
}
.feature file
#Smoke
Scenario: 5SH Share Privately
When I send share privately api
Then response share status code should be 201
And last my result
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< Automation:Automation >-----------------
[INFO] Building LifeboxAutomation 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # Automation ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 7 resources
[INFO] Finished at: 2022-09-15T13:08:38+03:00
[INFO] ------------------------------------------------------------------------
mtc BackendApi mvn test -Dcucumberoptions="--tags #Smoke" in pwsh at 13:08:38
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< Automation:LifeboxAutomation >-----------------
[INFO] Building Automation 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # Automation ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 7 resources
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # Automation ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # Automation ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 5 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # Automation ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) # Automation ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.056 s
[INFO] Finished at: 2022-09-15T13:20:17+03:00
[INFO] ------------------------------------------------------------------------
Thank you for your advice for now
Surefire normally automatically selects which test-framework provider to use based on the version of TestNG/JUnit present in your project's classpath.
You have both JUnit 5 and JUnit 4 on your classpath, so Surefire will pick JUnit 5 to run all tests. However you didn't include the JUnit Vintage engine so JUnit 5 will not execute JUnit 4 tests.
You're probably better of switching to JUnit 5 entirely though. Have a look at the cucumber-java-skeleton for that.

UnsupportedClassVersionError Unsupported major.minor version 52.0 (unable to load class )

The same war file when deployed on my machine works fine. However on ubuntu 14. and jdk 1.8 on remote server, I keep getting an exception when I deploy it to tomcat using maven.
I checked the jdk listed on the remote server:
root#li1242-163:~# sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-8-oracle/jre/bin/java 1072 auto mode
1 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode
* 2 /usr/lib/jvm/java-8-oracle/jre/bin/java 1072 manual mode
This is the java version on the remote serveR:
root#li1242-163:~# java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
May 26, 2015 12:10:27 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Allocate exception for servlet crudservlet
java.lang.UnsupportedClassVersionError: crudapproot/EntityResource : Unsupported major.minor version 52.0 (unable to load class crudapproot.EntityResource)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2948)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1208)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:274)
at org.glassfish.jersey.internal.util.ReflectionHelper$7.run(ReflectionHelper.java:402)
at org.glassfish.jersey.internal.util.ReflectionHelper$7.run(ReflectionHelper.java:397)
at java.security.AccessController.doPrivileged(Native Method)
at org.glassfish.jersey.server.internal.scanning.AnnotationAcceptingListener$AnnotatedClassVisitor.getClassForName(AnnotationAcceptingListener.java:262)
at org.glassfish.jersey.server.internal.scanning.AnnotationAcceptingListener$AnnotatedClassVisitor.visitEnd(AnnotationAcceptingListener.java:224)
at jersey.repackaged.org.objectweb.asm.ClassReader.accept(ClassReader.java:697)
at jersey.repackaged.org.objectweb.asm.ClassReader.accept(ClassReader.java:506)
at org.glassfish.jersey.server.internal.scanning.AnnotationAcceptingListener.process(AnnotationAcceptingListener.java:170)
at org.glassfish.jersey.server.ResourceConfig.scanClasses(ResourceConfig.java:899)
at org.glassfish.jersey.server.ResourceConfig._getClasses(ResourceConfig.java:856)
at org.glassfish.jersey.server.ResourceConfig.getClasses(ResourceConfig.java:762)
at org.glassfish.jersey.server.ResourceConfig$RuntimeConfig.<init>(ResourceConfig.java:1190)
at org.glassfish.jersey.server.ResourceConfig$RuntimeConfig.<init>(ResourceConfig.java:1162)
at org.glassfish.jersey.server.ResourceConfig.createRuntimeConfig(ResourceConfig.java:1158)
at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:322)
at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:338)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:171)
at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:363)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1279)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1192)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:864)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:134)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
I am deploying a webapplication using maven to a remote server, the pom file is configured as follows:
<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>OrbithubWeb</groupId>
<artifactId>OrbithubWeb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<!-- customize the catalina_home for remote deployment
for tomcat7, the remotedeployserverurl is http://localhost:8080/manager/text
and for tomcat6 http://localhost:8080/manager/html
-->
<properties>
<java-version>1.7</java-version>
<org.springframework-version>4.0.3.RELEASE</org.springframework-version>
<warfilename>${project.groupId}</warfilename>
<!-- change the url to : http://45.79.143.163:8080/manager/text -->
<remotedeployserverurl>http://localhost:8080/manager/text</remotedeployserverurl>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${org.springframework-version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- spring framework just added ends here -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20140107</version>
</dependency>
<!-- jersey dependencies ends -->
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.3.1</version>
</dependency>
<!-- jersey dependency ends -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<!-- used for httpclient library -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.35</version>
</dependency>
<!-- adding for log4j dependency for logging -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- Added 25 May: added the dependecy for Jax-RS 2.0 jersey core Servlet 3.x implementation -->
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>2.17</version>
</dependency>
<!-- Added 25 May: for jersey-client implementation -->
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.17</version>
</dependency>
<!-- dependency resolved for jax-rs -->
<!-- Uses this dependency to read from build.properties file. The artifact id # properties-maven-plugin -->
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
<!-- changes the default location of war deployment -->
<!-- commented it since we are directly deploying war to the ${catalina_home}/webapps -->
<!-- <warName>${warfilename}</warName> -->
<!-- <outputDirectory>${catalina_home}/webapps</outputDirectory> -->
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<!-- added to deploy maven build to remote tomcat, update = true :: redeploy's the war files on update -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>${remotedeployserverurl}</url>
<server>tomcat7</server>
<path>/${project.groupId}</path>
<!-- configuring the tomcat7 to update itself while deploying -->
<update>true</update>
<!-- added this on 25 April -->
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<!-- Associate the read-project-properties goal with the initialize phase, to read the properties file. -->
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<!-- taking the build.properties from the relative location of the pom file -->
<file>build.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
A snapshot of the deployment for war file on tomcat is :
root#li1242-163:~/OrbitHub-Java-Rest-API# mvn clean tomcat7:deploy
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building OrbithubWeb 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # OrbithubWeb ---
[INFO] Deleting /root/OrbitHub-Java-Rest-API/target
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.2:deploy (default-cli) # OrbithubWeb >>>
[INFO]
[INFO] --- properties-maven-plugin:1.0-alpha-2:read-project-properties (default) # OrbithubWeb ---
[INFO]
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) # OrbithubWeb ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # OrbithubWeb ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 19 source files to /root/OrbitHub-Java-Rest-API/target/classes
[WARNING] /root/OrbitHub-Java-Rest-API/src/test/TestCallToWebapp.java: /root/OrbitHub-Java-Rest-API/src/test/TestCallToWebapp.java uses or overrides a deprecated API.
[WARNING] /root/OrbitHub-Java-Rest-API/src/test/TestCallToWebapp.java: Recompile with -Xlint:deprecation for details.
[WARNING] /root/OrbitHub-Java-Rest-API/src/asyncrequesthandlr/ControllableExecutors.java: /root/OrbitHub-Java-Rest-API/src/asyncrequesthandlr/ControllableExecutors.java uses unchecked or unsafe operations.
[WARNING] /root/OrbitHub-Java-Rest-API/src/asyncrequesthandlr/ControllableExecutors.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-resources-plugin:2.3:testResources (default-testResources) # OrbithubWeb ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /root/OrbitHub-Java-Rest-API/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # OrbithubWeb ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) # OrbithubWeb ---
[INFO] No tests to run.
[INFO] Surefire report directory: /root/OrbitHub-Java-Rest-API/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-war-plugin:2.4:war (default-war) # OrbithubWeb ---
[INFO] Packaging webapp
[INFO] Assembling webapp [OrbithubWeb] in [/root/OrbitHub-Java-Rest-API/target/OrbithubWeb-0.0.1-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [/root/OrbitHub-Java-Rest-API/WebContent]
[INFO] Webapp assembled in [202 msecs]
[INFO] Building war: /root/OrbitHub-Java-Rest-API/target/OrbithubWeb-0.0.1-SNAPSHOT.war
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.2:deploy (default-cli) # OrbithubWeb <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:deploy (default-cli) # OrbithubWeb ---
[INFO] Deploying war to http://45.79.143.163:8080/OrbithubWeb
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Uploading: http://45.79.143.163:8080/manager/text/deploy?path=%2FOrbithubWeb&update=true
Uploaded: http://45.79.143.163:8080/manager/text/deploy?path=%2FOrbithubWeb&update=true (12330 KB at 20279.0 KB/sec)
[INFO] tomcatManager status code:200, ReasonPhrase:OK
[INFO] OK - Deployed application at context path /OrbithubWeb
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.924s
[INFO] Finished at: Tue May 26 00:00:28 UTC 2015
[INFO] Final Memory: 22M/54M
[INFO] ------------------------------------------------------------------------
This worked for me , I found a tutorial for the same here: https://askubuntu.com/questions/121654/how-to-set-default-java-version
:
Made changes to the JAVA_HOME variable : vi /etc/default/tomcat7
java8 was found here:
/usr/lib/jvm/java-8-oracle/bin/
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/java-8-oracle/bin/javac" 1
sudo update-alternatives --config javac
To check the jvm that the tomcat is using :
ps -ef | grep tomcat
Also, curl http://admin:admin#localhost:8080/manager/text/serverinfo

TestNG tests are not getting run when I execute testng.xml using POM file using maven-surefire

0 tests are getting run, when I execute testng.xml using POM file using Maven-surefire.
I am running few selenium tests using testng.xml.
When I run testng.xml file as TestNG test Suite, then it runs fine.
But, when I include testng.xml file (as below) then its not running :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
Below is my POM file snippet:
<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>SAPAutomation</groupId>
<artifactId>SAPAutomation</artifactId>
<!-- <version>3.2</version> -->
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>SAPAutomation</name>
<url>http://maven.apache.org</url>
<!-- For javadocs -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.17</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<!-- To exclude unwanted Package ex: com.SAPAutomation.TEMP etc-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<excludes>
<exclude>**/com/SAPAutomation/Temp/*</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>1.1.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.1.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.45.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>2.45.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.11</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.11</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.15</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<dependency>
<groupId>com.github.detro.ghostdriver</groupId>
<artifactId>phantomjsdriver</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.codeartisans.thirdparties.swing</groupId>
<artifactId>org-openide-util</artifactId>
<version>8.6.2</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14-10.2.0.4.0</artifactId>
<version>10.2.0.4.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/lib/ojdbc14.jar</systemPath>
<!-- <systemPath>${java.home}/lib/ojdbc14.jar</systemPath> -->
</dependency>
<dependency>
<groupId>org.monte.screenrecorder</groupId>
<artifactId>MonteScreenRecorder</artifactId>
<version>10</version>
<scope>system</scope>
<systemPath>${basedir}/src/lib/MonteScreenRecorder.jar</systemPath>
<!-- <systemPath>${java.home}/lib/ojdbc14.jar</systemPath> -->
</dependency>
<!-- <repositories>
<repository>
<id>ojdbc14</id>
<url>http://www.oracle.com/technetwork/apps-tech/jdbc-10201-088211.html</url>
</repository>
</repositories> -->
</dependencies>
</project>
My testng.xml file:
<suite name="Suite" parallel="tests">
<listeners>
<listener class-name="com.SAPAutomation.Listners.RetryListener"/>
</listeners>
<test name="Test1">
<parameter name="TestCaseId" value="TC1" />
<classes>
<class name="com.xyz.abc.MyAutomationTestByXML"/>
</classes>
</test>
<test name="Test2">
<parameter name="TestCaseId" value="TC2" />
<classes>
<class name="com.xyz.abc.MyAutomationTestByXML"/>
</classes>
</test>
<test name="Test3">
<parameter name="TestCaseId" value="TC3" />
<classes>
<class name="com.xyz.abc.MyAutomationTestByXML"/>
</classes>
</test>
</suite>
Test result of running Pom.xml:
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for SAPAutomation:SAPAutomation:jar:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.systemPath' for com.oracle:ojdbc14-10.2.0.4.0:jar should not point at files within the project directory, ${basedir}/src/lib/ojdbc14.jar will be unresolvable by dependent projects # line 153, column 16
[WARNING] 'dependencies.dependency.systemPath' for org.monte.screenrecorder:MonteScreenRecorder:jar should not point at files within the project directory, ${basedir}/src/lib/MonteScreenRecorder.jar will be unresolvable by dependent projects # line 162, column 15
[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] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SAPAutomation 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # SAPAutomation ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\AutomationWorkSpace\SAPAutomation\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) # SAPAutomation ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # SAPAutomation ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) # SAPAutomation ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 35 source files to C:\AutomationWorkSpace\SAPAutomation\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.14.1:test (default-test) # SAPAutomation ---
[INFO] Surefire report directory: C:\AutomationWorkSpace\SAPAutomation\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.496 sec
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.137 s
[INFO] Finished at: 2015-04-09T15:01:01+00:00
[INFO] Final Memory: 24M/277M
[INFO] ------------------------------------------------------------------------
Kindly advise.
Issue still persists, even after giving full path of Testng.xml in my POM.xml file.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for SAPAutomation:SAPAutomation:jar:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.systemPath' for com.oracle:ojdbc14-10.2.0.4.0:jar should not point at files within the project directory, ${basedir}/src/lib/ojdbc14.jar will be unresolvable by dependent projects # line 154, column 16
[WARNING] 'dependencies.dependency.systemPath' for org.monte.screenrecorder:MonteScreenRecorder:jar should not point at files within the project directory, ${basedir}/src/lib/MonteScreenRecorder.jar will be unresolvable by dependent projects # line 163, column 15
[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] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SAPAutomation 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # SAPAutomation ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\AutomationWorkSpace\SAPAutomation\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) # SAPAutomation ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # SAPAutomation ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) # SAPAutomation ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 35 source files to C:\AutomationWorkSpace\SAPAutomation\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.14.1:test (default-test) # SAPAutomation ---
[INFO] Surefire report directory: C:\AutomationWorkSpace\SAPAutomation\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.501 sec
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.402 s
[INFO] Finished at: 2015-04-14T17:31:11+00:00
[INFO] Final Memory: 22M/167M
[INFO] ------------------------------------------------------------------------
You can place your testng.xml file under project directly with your pom file then it will execute your test suite.
You need to provide the full path to the testng.xml file for Maven to pick it up.
I was facing this same scenario (issue) while doing the Maven with TestNG integration hands-on along with Rahul Sir's video.
Without the TestNG.xml, POM.xml was able to execute all the tests while being invoked using "mvn test" command from the CLI.
However, I noticed, if I just run the test directly from testng.xml i.e. "run as TestNG suite", then none of the test cases were run.
While took a close look into my test java classes, I discovered that, for using the #Test annotations before my test cases (methods), the import library was --> import org.junit.Test; Because even jUnit has a Test class in its library.
But since we are using TestNG, thus we must need to use this import --> import org.testng.annotations.Test;
While we create a Maven project within Eclipse using the project template i.e. maven-archetype-quickstart template, it creates two parallel folder structure -> one for java (to have the object models & utilities) and the other for test (to contain the test cases). So, by default, there is AppTest.java class and that uses jUnit library for #Test annotation.
So, right after creating the Maven project in eclipse, we should add the TestNG dependency in the pom.xml in case we know that we'll be using TestNG for execution.
I am able to have this issue resolved just by using import org.testng.annotations.Test; within each of my test classes.
TestNG SuiteXML will only work on those #Test annotations while org.testng.annotations.Test is present for the classess.
Hope this will resolve your error too. Thank you.
In the maven-surefire-plugin, provide the full path from under your project to your testng.xml file -- Example:
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
Above issue got resolved using updating version of Maven-Surefire-plugin in the mentioned POM.xml. Whole set-up lived Happily ever after & after!!
Thanks

junit and hamcrest declaration

I am using junit at 4.10 and declared hamcrest-core at 1.3 and hamcrest-library at 1.3. My question is are hamcrest-library and hamcrest-core embedded in junit 4.10. what about junit 4.11?
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
If you browse to search.maven.org you can search for artifacts and see their dependencies. If you are using Eclipse wit the Maven plugin, you can also click Dependency Hierarchy in the POM editor.
Looking on the Maven website you can see that JUnit 4.11 depends on Hamcrest 1.3:
<dependencies>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>compile</scope>
</dependency>
</dependencies>
Hamcrest library you have to add yourself.
JUnit 4.10 & JUnit 4.11 (as depicted below):
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
... ship with the hamcrest-core 1.1 and 1.3 respectively. You can see this for yourself by leveraging the dependency plugin's tree goal (running mvn dependency:tree):
$ mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building testng 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) # testng ---
[INFO] testng:testng:jar:1.0-SNAPSHOT
[INFO] \- junit:junit:jar:4.10:test
[INFO] \- org.hamcrest:hamcrest-core:jar:1.1:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.483s
[INFO] Finished at: Fri Mar 29 12:07:22 MDT 2013
[INFO] Final Memory: 5M/81M
[INFO] ------------------------------------------------------------------------
As silly as this sounds, you need to include the appropriate hamcrest-library artefact to take advantage of the Hamcrest Matchers. Hopefully this helps...

mvn compiler:compile works, mvn compile not

I have a project with a maven 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Minimal-J</groupId>
<artifactId>Minimal-J</artifactId>
<version>0.1-SNAPSHOT</version>
<name>Minimal-J</name>
<dependencies>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.8.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbyclient</artifactId>
<version>10.8.2.2</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin</artifactId>
<version>6.7.6</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.miglayout</groupId>
<artifactId>miglayout</artifactId>
<version>3.7.4</version>
</dependency>
<dependency>
<groupId>commons-dbutils</groupId>
<artifactId>commons-dbutils</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>2.3.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
if I execute
mvn compiler:compile
all 189 of my java classes are compiled
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Minimal-J 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-compiler-plugin:2.4:compile (default-cli) # Minimal-J ---
[INFO] Compiling 189 source files to C:\projects\open-ech\workspace\minimal-j\MinimalJ\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.386s
[INFO] Finished at: Fri May 11 11:50:54 CEST 2012
[INFO] Final Memory: 13M/37M
[INFO] ------------------------------------------------------------------------
if I simply type
mvn compile
Nothing seems to be done:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Minimal-J 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.120s
[INFO] Finished at: Fri May 11 11:53:36 CEST 2012
[INFO] Final Memory: 1M/15M
[INFO] ------------------------------------------------------------------------
In a other project everything works fine.
Where could I possibly have configured something wrong to trigger this behaviour?
It's because of pom packaging. By invoking mvn compiler:compile you run compile goal outside Maven's default lifecycle and that basically compile sources in src/main/java. And by mvn compile you run lifecycle up to compile phase and the actual goals executed in every single phase depend on project's packaging type then. pom-type project does nothing in compile phase, because - in fact - there is nothing to compile with just POM.
I suppose your intention was to have jar packaging and changing that should help.

Resources