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.
Related
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.
For some reason Maven is compiling old servlet dependency instead of the new one. I've tried to clean up cache using:
mvn dependency:purge-local-repository -DreResolve=false
and
mvn dependency:resolve
And that's what logs gave me:
[INFO]
[INFO] --- maven-dependency-plugin:2.8:resolve (default-cli) # examproject ---
[INFO]
[INFO] The following files have been resolved:
[INFO] com.google.cloud:google-cloud-core-http:jar:1.84.0:compile
[INFO] com.google.cloud.datastore:datastore-v1-proto-client:jar:1.6.0:compile
[INFO] org.threeten:threetenbp:jar:1.3.3:compile
[INFO] com.google.protobuf:protobuf-java:jar:3.7.1:compile
[INFO] io.grpc:grpc-core:jar:1.21.0:compile
[INFO] com.google.appengine.tools:appengine-gcs-client:jar:0.7:compile
[INFO] joda-time:joda-time:jar:2.3:compile
[INFO] javax.transaction:transaction-api:jar:1.1:compile
[INFO] com.google.api.grpc:proto-google-common-protos:jar:1.16.0:compile
[INFO] jstl:jstl:jar:1.2:compile
[INFO] com.google.oauth-client:google-oauth-client-appengine:jar:1.30.1:compile
[INFO] com.fasterxml.jackson.core:jackson-core:jar:2.9.9:compile
[INFO] com.google.j2objc:j2objc-annotations:jar:1.3:compile
[INFO] org.codehaus.mojo:animal-sniffer-annotations:jar:1.17:compile
[INFO] io.grpc:grpc-context:jar:1.19.0:compile
[INFO] com.googlecode.json-simple:json-simple:jar:1.1.1:compile
[INFO] com.google.api:gax-httpjson:jar:0.64.1:compile
[INFO] javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] com.google.appengine:appengine-api-1.0-sdk:jar:1.9.76:compile
[INFO] com.google.http-client:google-http-client-jackson:jar:1.20.0:compile
[INFO] io.opencensus:opencensus-contrib-grpc-metrics:jar:0.21.0:compile
[INFO] org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] com.google.code.gson:gson:jar:2.8.5:provided
[INFO] com.google.api.grpc:proto-google-iam-v1:jar:0.12.0:compile
[INFO] com.google.auth:google-auth-library-oauth2-http:jar:0.16.2:compile
[INFO] commons-logging:commons-logging:jar:1.2:compile
[INFO] com.google.cloud:google-cloud-datastore:jar:1.84.0:compile
[INFO] com.google.errorprone:error_prone_annotations:jar:2.3.2:compile
[INFO] com.google.http-client:google-http-client:jar:1.31.0:compile
[INFO] commons-codec:commons-codec:jar:1.11:compile
[INFO] com.google.http-client:google-http-client-jackson2:jar:1.31.0:compile
[INFO] com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] net.spy:spymemcached:jar:2.12.3:compile
[INFO] com.google.api:api-common:jar:1.8.1:compile
[INFO] com.google.guava:guava:jar:19.0:compile
[INFO] io.opencensus:opencensus-contrib-http-util:jar:0.21.0:compile
[INFO] com.google.http-client:google-http-client-protobuf:jar:1.20.0:compile
[INFO] com.google.oauth-client:google-oauth-client-servlet:jar:1.30.1:compile
[INFO] io.opencensus:opencensus-api:jar:0.21.0:compile
[INFO] com.google.api-client:google-api-client-servlet:jar:1.30.2:compile
[INFO] com.google.apis:google-api-services-storage:jar:v1-rev108-1.22.0:compile
[INFO] com.google.api.grpc:proto-google-cloud-datastore-v1:jar:0.67.0:compile
[INFO] com.google.http-client:google-http-client-appengine:jar:1.30.1:compile
[INFO] javax.servlet.jsp:javax.servlet.jsp-api:jar:2.3.1:provided
[INFO] io.grpc:grpc-api:jar:1.21.0:compile
[INFO] com.google.oauth-client:google-oauth-client:jar:1.22.0:compile
[INFO] org.apache.httpcomponents:httpclient:jar:4.5.9:compile
[INFO] com.google.cloud:google-cloud-core:jar:1.84.0:compile
[INFO] com.google.api-client:google-api-client-appengine:jar:1.30.2:compile
[INFO] org.apache.httpcomponents:httpcore:jar:4.4.11:compile
[INFO] com.google.protobuf:protobuf-java-util:jar:3.7.1:compile
[INFO] javax.servlet:javax.servlet-api:jar:3.1.0:provided
[INFO] com.google.api:gax:jar:1.47.1:compile
[INFO] com.google.auth:google-auth-library-credentials:jar:0.16.2:compile
[INFO] com.google.android:annotations:jar:4.1.1.4:compile
[INFO] junit:junit:jar:4.12:test
[INFO] javax.jdo:jdo2-api:jar:2.3-eb:compile
[INFO] org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] javax.servlet:servlet-api:jar:2.5:compile
[INFO] com.googlecode.objectify:objectify:jar:6.0.4:compile
[INFO] org.codehaus.jackson:jackson-core-asl:jar:1.9.11:compile
[INFO] com.google.api-client:google-api-client:jar:1.22.0:compile
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 48.139 s
[INFO] Finished at: 2019-08-12T10:51:40+02:00
[INFO] ------------------------------------------------------------------------
As you can see 3.1.0 is provided, but for some reason 2.5 is the one compiled. This is my POM, it is mostly pre-compiled and I've added few dependencies:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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>
<packaging>war</packaging>
<version>0.1.0-SNAPSHOT</version>
<groupId>examproject</groupId>
<artifactId>examproject</artifactId>
<properties>
<appengine.maven.plugin.version>2.1.0</appengine.maven.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-bom</artifactId>
<version>0.102.0-alpha</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.appengine.tools</groupId>
<artifactId>appengine-gcs-client</artifactId>
<version>0.7</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
<scope>provided</scope>
</dependency>
<!-- Compile/runtime dependencies -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>1.9.76</version>
</dependency>
<dependency>
<groupId>com.googlecode.objectify</groupId>
<artifactId>objectify</artifactId>
<version>6.0.4</version>
</dependency>
<!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- for hot reload of the web application -->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.maven.plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M2</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<!-- appengine-maven-plugin requires Maven 3.5.0 -->
<requireMavenVersion>
<version>3.5.0</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
In order to do a couple of things (Using getPart method and something else) I need 3.1.0 servlet.
UPDATE:
If I try to delete C:\Users\Gabriel.m2\repository\javax\servlet\servlet-api, It recreates the folder after I update the project. For some reason Maven is clearly using 2.5 servlet instead of 3.1.0 and I can't understand why.
This is the answer of Gabriel Costache, which I copy/pasted from the question:
I manged to solve it, I'm posting what I've done if someone will ever need it.
Basically, appengine-gcs-client artifact compiles by his own servlet 2.5.
If you have a similar issue, run
mvn dependency:tree
and find from where your dependency is compiled, than add an exclusion tag just like this
<dependency>
<groupId>com.google.appengine.tools</groupId>
<artifactId>appengine-gcs-client</artifactId>
<version>0.7</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
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"
Hi i'm a junior developer and i'm working on this project, like the title i can't link my ejb-client with the front-end (also back-end) is my first solo project, i wrote everything but i have some problems with the poms, on the foot of the topic there's the detailed maven error (sorry for format my first thread here)
Ejb Client Pom
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>it.isc</groupId>
<artifactId>ProgettoAziende</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>progettoaziende-ejb-client</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>progettoaziende-ejb-client</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.ibatis</groupId>
<artifactId>ibatis-core</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb-api</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-ejb-client-bom</artifactId>
<version>7.1.1.Final</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Front End pom.xml
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>it.isc</groupId>
<artifactId>ProgettoAziende</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>progettoaziende-frontend</artifactId>
<packaging>war</packaging>
<name>progetto aziende-frontend</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<finalName>progettoaziende-frontend</finalName>
</build>
<dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts-core</artifactId>
<version>1.3.10</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts-taglib</artifactId>
<version>1.3.10</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts-extras</artifactId>
<version>1.3.10</version>
</dependency>
<dependency>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-ejb-client</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>2.2.0.GA</version>
<scope>provided</scope>
</dependency>
<!-- Json Mapping -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
<version>2.2.0.GA</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
</dependencies>
</project>
SUPER POM
<?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>it.isc</groupId>
<artifactId>ProgettoAziende</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>ProgettoAziende</name>
<url>http://maven.apache.org</url>
<modules>
<module>progettoaziende-be-ear</module>
<module>progettoaziende-ejb-client</module>
<module>progettoaziende-be-ejb</module>
<module>progettoaziende-frontend</module>
</modules>
<properties>
<encoding>UTF-8</encoding>
<project.build.sourceEncoding>${encoding}</project.build.sourceEncoding>
<project.reporting.outputEncoding>${encoding}</project.reporting.outputEncoding>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-be-ear</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-ejb-client</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-be-ejb</artifactId>
<type>ejb</type>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-frontend</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
EJB Module
<?xml version="1.0"?>
<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>
<parent>
<groupId>it.isc</groupId>
<artifactId>ProgettoAziende</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-be-ejb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>progettoaziende-be-ejb</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.3</version>
<configuration>
<ejbVersion>3.1</ejbVersion>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.ibatis</groupId>
<artifactId>ibatis-core</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb-api</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-ejb-client</artifactId>
<type>ejb-client</type>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.ibatis</groupId>
<artifactId>ibatis-sqlmap</artifactId>
<version>2.3.4.726</version>
</dependency>
</dependencies>
</project>
MAVEN ERROR (I tried to compile the back-end module here, but is the same kind of problem with the front end, same error)
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building progettoaziende-be-ejb 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for it.isc:progettoaziende-ejb-client:jar:client:0.0.1-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.422 s
[INFO] Finished at: 2016-04-19T14:33:24+02:00
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project progettoaziende-be-ejb: Could not resolve dependencies for project it.isc:progettoaziende-be-ejb:jar:0.0.1-SNAPSHOT: Could not find artifact it.isc:progettoaziende-ejb-client:jar:client:0.0.1-SNAPSHOT -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
EDIT: FULL ERROR TRACE
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] ProgettoAziende
[INFO] progettoaziende-ejb-client
[INFO] progettoaziende-be-ejb
[INFO] progetto aziende-frontend
[INFO] progettoaziende-be-ear
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ProgettoAziende 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # ProgettoAziende ---
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # ProgettoAziende ---
[INFO] Installing C:\Users\DEV\workspace\ProgettoAziende\pom.xml to C:\Users\DEV\.m2\repository\it\isc\ProgettoAziende\0.0.1-SNAPSHOT\ProgettoAziende-0.0.1-SNAPSHOT.pom
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building progettoaziende-ejb-client 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # progettoaziende-ejb-client ---
[INFO] Deleting C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # progettoaziende-ejb-client ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # progettoaziende-ejb-client ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 17 source files to C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # progettoaziende-ejb-client ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # progettoaziende-ejb-client ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # progettoaziende-ejb-client ---
[INFO] Surefire report directory: C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.progettoaziende.ejb.client.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # progettoaziende-ejb-client ---
[INFO] Building jar: C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\target\progettoaziende-ejb-client-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # progettoaziende-ejb-client ---
[INFO] Installing C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\target\progettoaziende-ejb-client-0.0.1-SNAPSHOT.jar to C:\Users\DEV\.m2\repository\it\isc\progettoaziende-ejb-client\0.0.1-SNAPSHOT\progettoaziende-ejb-client-0.0.1-SNAPSHOT.jar
[INFO] Installing C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\pom.xml to C:\Users\DEV\.m2\repository\it\isc\progettoaziende-ejb-client\0.0.1-SNAPSHOT\progettoaziende-ejb-client-0.0.1-SNAPSHOT.pom
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building progettoaziende-be-ejb 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] ProgettoAziende .................................... SUCCESS [ 1.584 s]
[INFO] progettoaziende-ejb-client ......................... SUCCESS [ 9.071 s]
[INFO] progettoaziende-be-ejb ............................. FAILURE [ 0.160 s]
[INFO] progetto aziende-frontend .......................... SKIPPED
[INFO] progettoaziende-be-ear ............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.579 s
[INFO] Finished at: 2016-04-20T09:40:23+02:00
[INFO] Final Memory: 12M/28M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project progettoaziende-be-ejb: Could not resolve dependencies for project it.isc:progettoaziende-be-ejb:jar:0.0.1-SNAPSHOT: Could not find artifact it.isc:progettoaziende-ejb-client:jar:client:0.0.1-SNAPSHOT -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project progettoaziende-be-ejb: Could not resolve dependencies for project it.isc:progettoaziende-be-ejb:jar:0.0.1-SNAPSHOT: Could not find artifact it.isc:progettoaziende-ejb-client:jar:client:0.0.1-SNAPSHOT
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:221)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:127)
at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:257)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:200)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project it.isc:progettoaziende-be-ejb:jar:0.0.1-SNAPSHOT: Could not find artifact it.isc:progettoaziende-ejb-client:jar:client:0.0.1-SNAPSHOT
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:211)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:195)
... 23 more
Caused by: org.eclipse.aether.resolution.DependencyResolutionException: Could not find artifact it.isc:progettoaziende-ejb-client:jar:client:0.0.1-SNAPSHOT
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:384)
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:205)
... 24 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact it.isc:progettoaziende-ejb-client:jar:client:0.0.1-SNAPSHOT
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:367)
... 25 more
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact it.isc:progettoaziende-ejb-client:jar:client:0.0.1-SNAPSHOT
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:434)
... 27 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :progettoaziende-be-ejb
So, I'm assuming you're using the progettoaziende-ejb-client module as container for your EJB API interfaces, in order to share with both your progettoaziende-frontend and progettoaziende-be-ejb modules.
As you probably already figured out, you're not generating your EJB client correctly.
Instead of having two modules, progettoaziende-be-ejb and progettoaziende-ejb-client, you should only have one module: progettoaziende-be-ejb.
Then, on the pom.xml of this module, you'd say it is an EJB module and configure your Maven EJB Plugin in order to generate an EJB client:
<artifactId>progettoaziende-be-ejb</artifactId>
<packaging>ejb</packaging>
(...)
<build>
(...)
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.3</version>
<configuration>
(...)
<generateClient>true</generateClient>
(...)
</configuration>
</plugin>
</plugins>
(...)
</build>
Afterwards, in order to specify what your EJB client jar should or shouldn't contain, you could make use of the clientIncludes and clientExcludes elements:
<build>
(...)
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.3</version>
<configuration>
(...)
<generateClient>true</generateClient>
<clientIncludes>
<!-- this will include all files and directories under com/foo/bar -->
<clientInclude>com/foo/bar/**</clientInclude>
<!-- this will include all files and directories under com/foo/acme -->
<clientInclude>com/foo/acme/**</clientInclude>
<!-- this will include all files under com/example -->
<clientInclude>com/example/*</clientInclude>
</clientIncludes>
<clientExcludes>
<!-- this will exclude all files under com/example -->
<clientExclude>com/example/*</clientExclude>
<!-- this will exclude all files and directories with the name
sparrow under com/jack -->
<clientExclude>com/jack/**/sparrow</clientExclude>
</clientExcludes>
</configuration>
</plugin>
</plugins>
(...)
</build>
Finally, you should:
Remove the dependency progettoaziende-ejb-client from the pom.xml of progettoaziende-be-ejb module;
Modify the dependency progettoaziende-ejb-client on the pom.xml of your WAR module from:
<dependency>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-ejb-client</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
to:
<dependency>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-be-ejb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>ejb-client</type>
</dependency>
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...