maven -P option not working with mvn clean install - maven

When I try to build the project using
mvn clean package -P dev, it activates the dev profile and performs the build. But when I try with mvn clean install -P dev, it builds all the profiles.
I have more than one profiles in my pom.xml.
<profiles>
<!-- The Configuration of the development profile -->
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<build.profile.id>dev</build.profile.id>
<skip.integration.tests>true</skip.integration.tests>
<skip.unit.tests>false</skip.unit.tests>
</properties>
</profile>
<!-- The Configuration of the integration-test profile -->
<profile>
<id>integration-test</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<build.profile.id>integration-test</build.profile.id>
<skip.integration.tests>false</skip.integration.tests>
<skip.unit.tests>true</skip.unit.tests>
</properties>
</profile>
</profiles>
Also tried with mvn clean install --activate-profiles=dev, but with same results. Even -D option also did not work.
========================Update=====================================
Please find the complete POM here:
<?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>com.myservice</groupId>
<artifactId>myservicename</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<!-- Below property indicates the pattern of the test suite -->
<runSuite>**/*Test.class</runSuite>
</properties>
<profiles>
<!-- The Configuration of the development profile -->
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<build.profile.id>dev</build.profile.id>
<skip.integration.tests>true</skip.integration.tests>
<skip.unit.tests>false</skip.unit.tests>
</properties>
</profile>
<!-- The Configuration of the integration-test profile -->
<profile>
<id>integration-test</id>
<properties>
<build.profile.id>integration-test</build.profile.id>
<skip.integration.tests>false</skip.integration.tests>
<skip.unit.tests>true</skip.unit.tests>
</properties>
</profile>
</profiles>
<dependencies>
<!-- All Dependencies -->
</dependencies>
<build>
<plugins>
<!-- Adds source and resource directories to build -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.10</version>
<executions>
<!-- Add a new source directory to our build -->
<execution>
<id>add-integration-test-sources</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<!-- Configures the source directory of our integration tests -->
<sources>
<source>src/integration-test/java</source>
</sources>
</configuration>
</execution>
<!-- Add a new resource directory to our build -->
<execution>
<id>add-integration-test-resources</id>
<phase>generate-test-resources</phase>
<goals>
<goal>add-test-resource</goal>
</goals>
<configuration>
<!-- Configures the resource directory of our integration tests -->
<resources>
<!-- Placeholders that are found from the files located in the configured
resource directories are replaced with the property values found from the
profile specific configuration file. -->
<resource>
<filtering>true</filtering>
<directory>src/integration-test/resources</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!-- Below plugin ensures the execution of test cases during maven build -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- Skips unit tests if the value of skip.unit.tests property is true -->
<skipTests>${skip.unit.tests}</skipTests>
<includes>
<include>${runSuite}</include>
</includes>
<excludes>
<exclude>com.myservice.testsuite.service.*</exclude>
</excludes>
</configuration>
</plugin>
<!-- Runs integration tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18</version>
<executions>
<!-- Invokes both the integration-test and the verify goals of the Failsafe Maven plugin -->
<execution>
<id>integration-tests</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<!-- Skips integration tests if the value of skip.integration.tests property is true -->
<skipTests>${skip.integration.tests}</skipTests>
<includes>
<include>**/*IntegrationTest.class</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</pluginManagement>
</build>
</project>
And also the console output for mvn clean install -P dev:
c:\path\to\gitrepo\service>mvn clean install -P dev
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building TwelveFactorAnswers 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) # myservicename ---
[INFO] Deleting c:\path\to\gitrepo\service\target
[INFO]
[INFO] --- jacoco-maven-plugin:0.7.9:prepare-agent (jacoco-initialize) # myservicename ---
[INFO]
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # myservicename ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # myservicename ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 16 source files to c:\path\to\gitrepo\service\target\classes
[INFO]
[INFO] --- build-helper-maven-plugin:1.10:add-test-source (add-integration-test-sources) # myservicename ---
[INFO] Test Source directory: c:\path\to\gitrepo\service\src\integration-test\java added.
[INFO]
[INFO] --- build-helper-maven-plugin:1.10:add-test-resource (add-integration-test-resources) # myservicename ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # myservicename ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory c:\path\to\gitrepo\service\src\test\resources
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # myservicename ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to c:\path\to\gitrepo\service\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) # myservicename ---
[INFO] Surefire report directory: c:\path\to\gitrepo\service\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
||
||
|| All the JUnit Test runs - sample Junit Test Class - <ServiceName>Test.java
||
||
Results :
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- jacoco-maven-plugin:0.7.9:check (jacoco-check) # myservicename ---
[INFO] Loading execution data file c:\path\to\gitrepo\service\target\jacoco.exec
[INFO] Analyzed bundle 'myservicename' with 16 classes
[INFO] All coverage checks have been met.
[INFO]
[INFO] --- maven-jar-plugin:2.6:jar (default-jar) # myservicename ---
[INFO] Building jar: c:\path\to\gitrepo\service\target\myservicename-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:1.5.9.RELEASE:repackage (default) # myservicename ---
[INFO]
[INFO] --- jacoco-maven-plugin:0.7.9:report (jacoco-site) # myservicename ---
[INFO] Loading execution data file c:\path\to\gitrepo\service\target\jacoco.exec
[INFO] Analyzed bundle 'TwelveFactorAnswers' with 16 classes
[INFO]
[INFO] --- maven-failsafe-plugin:2.18:integration-test (default) # myservicename ---
[INFO] Failsafe report directory: c:\path\to\gitrepo\service\target\failsafe-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
||
||
|| All the Integration Test runs - sample Integration Test Class - <ServiceName>IT.java
||
||
Tests run: 2, Failures: 1, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-failsafe-plugin:2.18:integration-test (integration-tests) # myservicename ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-failsafe-plugin:2.18:verify (default) # myservicename ---
[INFO] Failsafe report directory: c:\path\to\gitrepo\service\target\failsafe-reports
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:15 min
[INFO] Finished at: 2018-02-16T14:28:05+05:30
[INFO] Final Memory: 38M/269M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.18:verify (default) on project myservicename: There are test failures.
[ERROR]
[ERROR] Please refer to c:\path\to\gitrepo\service\target\failsafe-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

I think I may have have found the reason for the above behavior. Reference
Before explaining my findings, let me clarify few things:
All my Integration Test class are post-fixed with IT (Example: ServiceIT.java)
All the Integration Test related files (sources & resources) are kept in a folder called integartion-tests inside src folder (example: "src/integration-tests/java" & "src/integration-tests/resources")
Now what I've learnt is:
integration-test phase is included in install, verify & deploy goals.
By default, maven considers any class name ending with -IT and inside test or integration-test folder (eventually in test-classes folder) as Integration Test Class.
Now in my support:
If you look closely in the console output I've pasted, you'll find that the integration-test is being executed twice -
Once:
[INFO] --- maven-failsafe-plugin:2.18:integration-test (default) # myservicename ---
[INFO] Failsafe report directory: c:\path\to\gitrepo\service\target\failsafe-reports
Twice:
[INFO] --- maven-failsafe-plugin:2.18:integration-test (integration-tests) # myservicename ---
[INFO] Tests are skipped.
The first time is being executed as default phase (as a part of install goal). The second time it is being skipped, since the dev profile is being activated, in which the integration-test are skipped.
Why am I so sure?
I changed the Integration Test classes from ServiceIT.java to ServiceIntegrationTest.java and updated the plugin accordingly in pom.xml.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18</version>
<executions>
<!-- Invokes both the integration-test and the verify goals of the Failsafe Maven plugin -->
<execution>
<id>integration-tests</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<!-- Skips integration tests if the value of skip.integration.tests property is true -->
<skipTests>${skip.integration.tests}</skipTests>
<includes>
<include>**/*IntegrationTest.class</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
Now, for maven, there is no default class for Integration Test and the integration-tests profile is not activated. Hence, maven did not find any default integration test to run. And the console output came as:
[INFO] --- maven-failsafe-plugin:2.18:integration-test (default) # twelvefactorquestion ---
[INFO]
[INFO] --- maven-failsafe-plugin:2.18:integration-test (integration-tests) # twelvefactorquestion ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-failsafe-plugin:2.18:verify (default) # twelvefactorquestion ---
[INFO] Failsafe report directory: c:\Work\12Factor\git\twelveFactorQuestion\target\failsafe-reports
[INFO]
[INFO] --- maven-failsafe-plugin:2.18:verify (integration-tests) # twelvefactorquestion ---
[INFO] Tests are skipped.

Related

How to Integrate Integration Tests Using Cucumber 6 and Maven

I really need help here.
Objective: Run my cucumber integration tests using Cucumber-Java8 version 6.7.0 with Maven 3.6.3.
Actual Scenario: When I run maven using this command: $ mvn clean verify -Pintegration-tests I am receiving this result.
xxxxx # xxx <Project Name> % mvn clean verify -Pintegration-tests
[INFO] Scanning for projects...
[INFO]
[INFO] ----------< <Project Name> >----------
[INFO] Building <Project Name> 0.0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) # <Project Name> ---
[INFO] Deleting /Users/<home>/Documents/repos/xxx/<Project Name>/target
[INFO]
[INFO] --- build-helper-maven-plugin:3.1.0:add-test-source (add-source) # <Project Name> ---
***[INFO] Test Source directory: /Users/<home>/Documents/repos/xxxx/<Project Name>/src/testintegration added.***
[INFO]
[INFO] --- build-helper-maven-plugin:3.1.0:add-test-resource (add-resource) # <Project Name ---
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) # <Project Name> ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 13 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) # <Project Name> ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 223 source files to /Users/<home>/Documents/repos/xxx/<Project Name>
...
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) # <Project Name> ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 15 resources
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) # n<Project Name> ---
[INFO] Changes detected - recompiling the module!
...
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) # <Project Name> ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) # <Project Name> ---
[INFO] Building jar: /Users/<home>/Documents/repos/xxxx/<Project Name> -server/target/<Project Name>.jar
[INFO]
[INFO] --- maven-failsafe-plugin:2.22.2:integration-test (default) # <Project Name> ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-failsafe-plugin:2.22.2:verify (default) # <Project Name> ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.484 s
[INFO] Finished at: 2020-10-17T13:07:50+01:00
[INFO] ------------------------------------------------------------------------
I didn't put any code in my Definition Class except "Sysout" and assertTrue. The Integration Test runs when I use a runner that I created trigger by Intellij.
#RunWith(Cucumber.class)
#CucumberOptions(
features = {"src/testintegration/java/features"},
glue = {"steps"},
plugin = {"pretty", "html:target/cucumber"},
publish = true)
public class RunCucumberIT {
Code Scenario Actual
Sctructure of the Project - Intellij
Maven File - Snipped
<!-- Integration tests -->
<profiles>
<profile>
<id>integration-tests</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<cucumber.plugin>json:target/report.json</cucumber.plugin>
<cucumber.filter.tags>#wip</cucumber.filter.tags>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.7</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/testintegration/</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-resource</id>
<phase>generate-sources</phase>
<goals>
<goal>add-test-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src/testintegration/resources/features</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!-- block unit tests execution -->
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<systemPropertyVariables>
<cucumber.plugin>${cucumber.plugin}</cucumber.plugin>
<cucumber.filter.tags>${cucumber.filter.tags}</cucumber.filter.tags>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- Cucumber -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java8</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>6.2.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
Definition Class
package steps;
import static org.junit.jupiter.api.Assertions.assertTrue;
import io.cucumber.java8.En;
public class Authorization implements En {
public Authorization() {
Given("the system knows about the following attributes",
(io.cucumber.datatable.DataTable dataTable) -> {
System.out.println("AUTHORIZATION GIVEN TEST");
assertTrue(true);
});
When("the client request POST \\/login", () -> {
System.out.println("AUTHORIZATION When TEST");
assertTrue(true);
});
Then("the response should be JSON", (io.cucumber.datatable.DataTable dataTable) -> {
System.out.println("AUTHORIZATION Then TEST");
assertTrue(true);
});
}
}
Part of Feature File
Feature: Authorization
#wip
Scenario: Login into account
...
Runner Class - (When I trigger this class by Intellij my test run correctly
package runner;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
#RunWith(Cucumber.class)
#CucumberOptions(
features = {"src/testintegration/java/features"},
glue = {"steps"},
plugin = {"pretty", "html:target/cucumber"},
publish = true)
public class RunCucumberIT {
}
I used this page here to try to do work my tests. But to be honest I don't know if I am doing something wrong or the article is missing something.
Here is the website.(weblogism)
Please, could someone check the Pom.xml file? I think I am missing something.
Many thanks if someone can help me here.
Cheers,

Maven flatten plugin not working does not substitute my version property

For some reason when i do mvn install and check my local repo and look at the pom there, i don't see that the version variable was substituted with the value.
I am using a parent pom with a version in the properties
<properties>
<maven.javadoc.skip>true</maven.javadoc.skip>
<revision>19.3.29</revision>
</properties>
It also contains the flatten plugin entry:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.2.2</version>
<configuration>
<updatePomFile>true</updatePomFile>
<flattenMode>resolveCiFriendliesOnly</flattenMode>
</configuration>
<executions>
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
The child pom uses the ${revision} as the value for the version & ${project.version} for dependencies as recommended by maven:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>analysisModule</artifactId>
<version>${revision}</version>
<parent>
<groupId>com.mycompany.analysis</groupId>
<version>1.0.0</version>
<artifactId>autoav</artifactId>
<relativePath>../autoAV</relativePath>
</parent>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<dependencies>
<dependency>
<groupId>com.mycompany.analysis</groupId>
<artifactId>analysisCore</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
Looking at the local repo pom xml after I 'mvn install' :
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>analysisJdbc</artifactId>
<version>${revision}</version>
<description>analysis of jdbc sources</description>
<parent>
<groupId>com.mycompany.analysis</groupId>
<version>1.0.0</version>
<artifactId>autoav</artifactId>
<relativePath>../autoAV</relativePath>
</parent>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<dependencies>
<dependency>
<groupId>com.mycompany.analysis</groupId>
<artifactId>analysisCore</artifactId>
<version>${project.version}</version>
</dependency>
...
</project>
Shouldn't the ${revision} & ${project.version} been replaced with the actual numbers ?
Isn't that the whole thing about using flatten plugin ?
I followed this
https://www.mojohaus.org/flatten-maven-plugin/examples/example-central-version.html
Adding my output of mvn install (skipping tests) (maven version 3.3.9):
02:12:03 :/code/thedrs/gitrepos/analysis/analysis/analysisJdbc (main) $ mvn install -Dmaven.test.skip=true
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building analysisJdbc 19.3.30
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # analysisJdbc ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # analysisJdbc ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # analysisJdbc ---
[INFO] Not copying test resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # analysisJdbc ---
[INFO] Not compiling test sources
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # analysisJdbc ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # analysisJdbc ---
[INFO] Building jar: /code/thedrs/gitrepos/analysis/analysis/analysisJdbc/target/analysisJdbc-19.3.30.jar
[INFO] META-INF/maven/com.mycompany.analysis/analysisJdbc/pom.xml already added, skipping
[INFO] META-INF/maven/com.mycompany.analysis/analysisJdbc/pom.properties already added, skipping
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # analysisJdbc ---
[INFO] Installing /code/thedrs/gitrepos/analysis/analysis/analysisJdbc/target/analysisJdbc-19.3.30.jar to /code/thedrs/.m2/com/mycompany/analysis/analysisJdbc/19.3.30/analysisJdbc-19.3.30.jar
[INFO] Installing /code/thedrs/gitrepos/analysis/analysis/analysisJdbc/pom.xml to /code/thedrs/.m2/com/mycompany/analysis/analysisJdbc/19.3.30/analysisJdbc-19.3.30.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.147 s
[INFO] Finished at: 2020-05-06T02:12:40-07:00
[INFO] Final Memory: 14M/356M
[INFO] ------------------------------------------------------------------------
You need to move the plugin from <pluginManagement><plugins> to <plugins>. Alternatively, you can leave it there and just add a short plugin definition (including groupId and artifactId) to the <plugins> section.
<pluginManagement> is just to preconfigure version numbers and configuration. Plugins in <pluginManagement> are not run during the build unless they reappear in <plugins>.
I've been able to achieve that by creating another property for the dependencies. This property will have the same value as ${revision} and will be replaced in the generated pom file.
<properties>
<revision>19.3.29</revision>
<my-lib.version>${revision}</my-lib.version>
</properties>
Then instead of using ${project.version} in your dependencies, use your property:
<dependency>
<groupId>com.mycompany.analysis</groupId>
<artifactId>analysisCore</artifactId>
<version>${my-lib.version}</version>
</dependency>

maven-resources-plugin + profiles

I am moving an existing project (legacy) to maven. It has the following structure:
ParentProject
- EARModule
- src
- target
- pom.xml (ear)
- WARModule
- src
- main
- java
- (java packages and classes)
- resources
- dev
- index.jsp
- prod
- index.jsp
- webapp
- views
- index.jsp (original)
- WEB-INF
- target
- pom.xml (war)
- pom.xml (parent)
I intend to have two different profiles: production and development. In production profile, /WARModule/src/main/resources/prod/index.jsp should be assembled into views/ war directory. In development profile, /WARModule/src/main/resources/dev/index.jsp should be copied into views/ war directory.
For that, I am trying to make use of the maven-resources-plugin, which I am configuring in war pom.xml.
<properties>
<prodResourcesDir>${basedir}/src/main/resources/prod</prodResourcesDir>
<devResourcesDir>${basedir}/src/main/resources/dev</devResourcesDir>
<viewsDir>${basedir}/target/WARModule/views</viewsDir>
</properties>
<profiles>
<profile>
<id>development</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy_development_index.jsp</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${viewsDir}</outputDirectory>
<resources>
<resource>
<directory>${devResourcesDir}</directory>
<filtering>true</filtering>
<includes>
<include>index.jsp</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>production</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy_production_index.jsp</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${viewsDir}</outputDirectory>
<resources>
<resource>
<directory>${prodResourcesDir}</directory>
<includes>
<include>index.jsp</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
As you can see above, I am creating two profiles (production and development) and configuring the resources plugin under each of them.
When I run mvn install -P any_of_the_profiles, index.jsp is not copied to the specified destination. Instead, I get the original version. Can anyone help me sort this out?
Below the log trace:
$ mvn -P production install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] ParentProject
[INFO] WebModule Maven Webapp
[INFO] EARModule
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ParentProject 0.0.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # ParentProject ---
[INFO] Installing D:\workspace\mvn_projects\ParentProject\pom.xml to C:\Users\a048148\.m2\repository\my\org\ParentProject\0.0.2-SNAPSHOT\ParentProject-0.0.2-SNAPSHOT.pom
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building WebModule Maven Webapp 0.0.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # WebModule ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 10 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # WebModule ---
[INFO] Changes detected - recompiling the module!
[INFO] Compilation messages...
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # WebModule ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\workspace\mvn_projects\ParentProject\WebModule\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # WebModule ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # WebModule ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-resources-plugin:2.6:copy-resources (copy_index.jsp) # WebModule ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) # WebModule ---
[INFO] Packaging webapp
[INFO] Assembling webapp [WebModule] in [D:\workspace\mvn_projects\ParentProject\WebModule\target\WebModule]
[INFO] Processing war project
[INFO] Copying webapp resources [D:\workspace\mvn_projects\ParentProject\WebModule\src\main\webapp]
[INFO] Webapp assembled in [3122 msecs]
[INFO] Building war: D:\workspace\mvn_projects\ParentProject\WebModule\target\WebModule.war
[INFO] WEB-INF\web.xml already added, skipping
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # WebModule ---
[INFO] Installing D:\workspace\mvn_projects\ParentProject\WebModule\target\WebModule.war to C:\Users\a048148\.m2\repository\my\org\WebModule\0.0.2-SNAPSHOT\WebModule-0.0.2-SNAPSHOT.war
[INFO] Installing D:\workspace\mvn_projects\ParentProject\WebModule\pom.xml to C:\Users\a048148\.m2\repository\my\org\WebModule\0.0.2-SNAPSHOT\WebModule-0.0.2-SNAPSHOT.pom
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building EARModule 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-ear-plugin:2.8:generate-application-xml (default-generate-application-xml) # EARModule ---
[INFO] Generating application.xml
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # EARModule ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-ear-plugin:2.8:ear (default-ear) # EARModule ---
[INFO] Copying artifact [war:com.bbh:WebModule:0.0.1-SNAPSHOT] to [WebModule-0.0.1-SNAPSHOT.war]
[INFO] Could not find manifest file: D:\workspace\mvn_projects\ParentProject\EARModule\target\ParentProject\META-INF\MANIFEST.MF - Generating one
[INFO] Building jar: D:\workspace\mvn_projects\ParentProject\EARModule\target\ParentProject.ear
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # EARModule ---
[INFO] Installing D:\workspace\mvn_projects\ParentProject\EARModule\target\ParentProject.ear to C:\Users\a048148\.m2\repository\my\org\EARModule\0.0.1-SNAPSHOT\EARModule-0.0.1-SNAPSHOT.ear
[INFO] Installing D:\workspace\mvn_projects\ParentProject\EARModule\pom.xml to C:\Users\a048148\.m2\repository\my\org\EARModule\0.0.1-SNAPSHOT\EARModule-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] ParentProject .......................................... SUCCESS [ 0.229 s]
[INFO] WebModule Maven Webapp ................................ SUCCESS [ 19.470 s]
[INFO] EARModule ............................................. SUCCESS [ 3.049 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22.892 s
[INFO] Finished at: 2016-12-12T15:18:14+01:00
[INFO] Final Memory: 39M/247M
[INFO] ------------------------------------------------------------------------
I ended up figuring out that maven-resources-plugin works just fine for resources, not web resources (JSP).
So I switched my approach to the maven-war-plugin filtering feature and specifying the destination path. Thus, the profiles section in my web pom.xml ended up like this:
<profiles>
<profile>
<id>development</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<webResources>
<resource>
<directory>${devResourcesDir}</directory>
<filtering>true</filtering>
<targetPath>views</targetPath> <!-- target/WebModule/ subdirectory -->
<include>index.jsp</include>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>production</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<webResources>
<resource>
<directory>${prodResourcesDir}</directory>
<filtering>true</filtering>
<targetPath>views</targetPath> <!-- target/WebModule/ subdirectory -->
<include>index.jsp</include>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
This tells maven-war-plugin to move index.jsp from the specified resources directory to the target/WebModule/views directory. It is all done by the war plugin just before packaging the war, so there is no need to specify the life cycle phase.

including several jar projects into one WAR

I have 4 maven projects that should work as one application, one parent project who is responsible for building all other, one war project with jsf and beans, one jpa project with entities and one ejb project with dao and ejb layer. I try to run on tomee server my .war, but it doesn't include the other classes from jpa and ajb project...Here are poms:
EclipseJPA2-parent:
....
<groupId>pka</groupId>
<artifactId>EclipseJPA2-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<profiles>
<profile>
<id>EclipseJPA2</id>
<modules>
<module>../EclipseJPA2-war</module>
<module>../EclipseJPA2-jpa</module>
<module>../EclipseJPA2-ejb</module>
</modules>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
</profiles>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>pka</groupId>
<artifactId>EclipseJPA2-war</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>pka</groupId>
<artifactId>EclipseJPA2-jpa</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>pka</groupId>
<artifactId>EclipseJPA2-ejb</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.3</version>
<configuration>
<!-- Tell Maven we are using EJB 3.1 -->
<ejbVersion>3.1</ejbVersion>
<generateClient>true</generateClient>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.openejb.maven</groupId>
<artifactId>tomee-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<tomeeVersion>1.5.2</tomeeVersion>
<tomeeClassifier>plus</tomeeClassifier>
<debugPort>5005</debugPort>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
EclipseJPA2-jpa:
...
<parent>
<groupId>pka</groupId>
<artifactId>EclipseJPA2-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>EclipseJPA2-jpa</artifactId>
<name>EclipseJPA2-jpa</name>
<description></description>
<dependencies>
....
</dependencies>
EclipseJPA2-ejb:
...
<parent>
<groupId>pka</groupId>
<artifactId>EclipseJPA2-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>EclipseJPA2-ejb</artifactId>
<packaging>ejb</packaging>
<name>EclipseJPA2-ejb</name>
<dependencies>
<dependency>
<groupId>pka</groupId>
<artifactId>EclipseJPA2-jpa</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
...
</dependencies>
and EclipseJPA2-war
...
<artifactId>EclipseJPA2-war</artifactId>
<packaging>war</packaging>
<name>EclipseJPA2-war</name>
<parent>
<artifactId>EclipseJPA2-parent</artifactId>
<groupId>pka</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>pka</groupId>
<artifactId>EclipseJPA2-jpa</artifactId>
<type>jar</type>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>pka</groupId>
<artifactId>EclipseJPA2-ejb</artifactId>
<type>ejb</type>
<version>0.0.1-SNAPSHOT</version>
</dependency>
...
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<version.primefaces>3.5</version.primefaces>
<version.primefaces.themes>1.0.9</version.primefaces.themes>
</properties>
<repositories>
...
</repositories>
Do you know how to properly link those projects and include jars in war ?
mvn package output:
....
[INFO] ------------------------------------------------------------------------
[INFO] Building EclipseJPA2-jpa 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # EclipseJPA2-jpa - --
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1250 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # EclipseJPA2-jpa ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) # EclipseJPA2-jpa ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1250 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # EclipseJPA2-jpa ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) # EclipseJPA2-jpa ---
[INFO] Surefire report directory: D:\usr\java\moje\system\EclipseJPA2-jpa\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.3.2:jar (default-jar) # EclipseJPA2-jpa ---
....
[INFO] ------------------------------------------------------------------------
[INFO] Building EclipseJPA2-ejb 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # EclipseJPA2-ejb ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1250 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # EclipseJPA2-ejb ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) # EclipseJPA2-ejb ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1250 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # EclipseJPA2-ejb ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) # EclipseJPA2-ejb ---
[INFO] Surefire report directory: D:\usr\java\moje\system\EclipseJPA2-ejb\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-ejb-plugin:2.3:ejb (default-ejb) # EclipseJPA2-ejb ---
[INFO] Building EJB EclipseJPA2-ejb-0.0.1-SNAPSHOT with EJB version 3.1
[INFO] Building jar: D:\usr\java\moje\system\EclipseJPA2-ejb\target\EclipseJPA2-ejb-0.0.1-SNAPSHOT.jar
[INFO] Building EJB client EclipseJPA2-ejb-0.0.1-SNAPSHOT-client
[INFO] Building jar: D:\usr\java\moje\system\EclipseJPA2-ejb\target\EclipseJPA2-ejb-0.0.1-SNAPSHOT-client.jar
....

unable to run Maven projects from TestNG thru command line...!

i have configured my eclipse with maven and testNG, PF my pom.xml below:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>iONAutomation</artifactId>
<groupId>com.iON.tcs</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>com.iON.tcs</groupId>
<artifactId>common</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>common</name>
<description>maintains all common code</description>
<profiles>
<profile>
<id>selenium-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.3.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
am runnong from the cmd prompt thu this dir: D:\EclipseWorkspace\iON27Feb2013\iONAutomation\common>
I tried usinng mvn test and mvn -Dtest=NewTest test commands, didnot succeed.
My cmd console displays:
D:\EclipseWorkspace\iON27Feb2013\iONAutomation\common>mvn test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building common 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # common ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # common ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) # co
mmon ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # commo
n ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) # common ---
[INFO] Surefire report directory: D:\EclipseWorkspace\iON27Feb2013\iONAutomation
\common\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: 0.932s
[INFO] Finished at: Thu Feb 28 19:11:43 IST 2013
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------
If you have a profile defined, then afaik, you need to invoke that profile ...mvn test -Pselenium-tests. As such if there is no particular reason for u to use profiles, then you might just go without them, in which case mvn test should work just fine.
Did you try to put
<sourceDirectory>/home/{userName}/{projectLocation}/src/main/java/packageTest</sourceDirectory>
inside your build ?
I had the same problem and this line solved it.
You can also try to add a goal to your pom file
<execution>
<id>default-test</id>
<phase>test</phase>``
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
</configuration>
</execution>
Hope it will help you !

Resources