Getting skip non existing resourceDirectory issue while using properties maven plugin iterator plugin and resources plugin - maven

I am trying to use three maven plugin at a time but getting error while executing. My goal is to read each environment properties that will place under src folder like application-sit.properties .. etc.
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>com.test.config</groupId>
<artifactId>config-poc</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>config-poc</name>
<build>
<directory>${project.basedir}/target</directory>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/config/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.*</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>com.soebes.maven.plugins</groupId>
<artifactId>iterator-maven-plugin</artifactId>
<version>0.5.1</version>
<executions>
<execution>
<id>moving property file</id>
<phase>initialize</phase>
<goals>
<goal>iterator</goal>
</goals>
<configuration>
<items>
<item>sit</item>
<item>uat</item>
</items>
<pluginExecutors>
<pluginExecutor>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0.0</version>
</plugin>
<goal>read-project-properties</goal>
<configuration>
<files>
<file>${project.basedir}/config/resources/environments/common.properties</file>
<file>${project.basedir}/config/resources/environments/#item#.properties</file>
</files>
</configuration>
</pluginExecutor>
<pluginExecutor>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
</plugin>
<goal>copy-resources</goal>
<configuration>
<outputDirectory>${project.build.outputDirectory}/config/${item}/</outputDirectory>
<resources>
<resource>
<directory>${project.build.outputDirectory}</directory>
<filtering>false</filtering>
<include>*.properties</include>
</resource>
</resources>
</configuration>
</pluginExecutor>
</pluginExecutors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Getting below error while executing looks like read property plugin is not generating application.properties inside target folder. Below is the snapshot of my project.
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< com.test.config:config-poc >---------------------
[INFO] Building config-poc 0.0.1-SNAPSHOT
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # config-poc ---
[INFO]
[INFO] --- iterator-maven-plugin:0.5.1:iterator (moving property file) # config-poc ---
[INFO] ------ (sit) org.codehaus.mojo:properties-maven-plugin:1.0.0:read-project-properties
[INFO] ------ (sit) org.apache.maven.plugins:maven-resources-plugin:2.7:copy-resources
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\eclipse\F\eclipse_workspace3\config-poc\target\classes
[INFO] ------ (uat) org.codehaus.mojo:properties-maven-plugin:1.0.0:read-project-properties
[INFO] ------ (uat) org.apache.maven.plugins:maven-resources-plugin:2.7:copy-resources
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\eclipse\F\eclipse_workspace3\config-poc\target\classes
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # config-poc ---
[INFO] Installing C:\eclipse\F\eclipse_workspace3\config-poc\pom.xml to C:\Users\Abhishek\.m2\repository\com\test\config\config-poc\0.0.1-SNAPSHOT\config-poc-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.798 s
[INFO] Finished at: 2020-08-29T16:29:36+05:30
[INFO] ------------------------------------------------------------------------

Below pluginExecutor structure will solve your problem.
<pluginExecutor>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<goal>copy-resources</goal>
<configuration>
<outputDirectory>${project.build.outputDirectory}/${item}/</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/config/resources/templates</directory>
<filtering>false</filtering>
<include>application.properties</include>
</resource>
</resources>
</configuration>

Related

Build runnable jar file for BDD Serenity Java project using Maven

I have built a BDD Serenity project in IntelliJ using Maven 3.6.3. I need to build a runnable jar file so that the BDD tests can run on another laptop.
I run "mvn clean package" and I get the message "JAR will be empty - no content was marked for inclusion!"
Please help, I am not sure on how to resolve this issue. Below is the output, as well as the POM file.
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< equalexperts:hotelbookings >---------------------
[INFO] Building Serenity project with JUnit and WebDriver 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # hotelbookings ---
[INFO] Deleting C:\Intelli- Projects\serenity-tutorials\hotelbookings\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # hotelbookings ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Intelli- Projects\serenity-tutorials\hotelbookings\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) # hotelbookings ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # hotelbookings ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Intelli- Projects\serenity-tutorials\hotelbookings\test
[INFO]
[INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) # hotelbookings ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to C:\Intelli- Projects\serenity-tutorials\hotelbookings\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) # hotelbookings ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) # hotelbookings ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: C:\Intelli- Projects\serenity-tutorials\hotelbookings\target\hotelbookings-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.740 s
[INFO] Finished at: 2021-01-24T17:38:50+02:00
[INFO] ------------------------------------------------------------------------
4.0.0
<groupId>equalexperts</groupId>
<artifactId>hotelbookings</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Serenity project with JUnit and WebDriver</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<serenity.version>2.3.2</serenity.version>
</properties>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>bintray</name>
<url>https://jcenter.bintray.com</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>bintray-plugins</name>
<url>https://jcenter.bintray.com</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-core</artifactId>
<version>${serenity.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-junit</artifactId>
<version>${serenity.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-assembly-plugin -->
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-assembly-plugin -->
</dependencies>
<build>
<testResources>
<testResource>
<directory>test</directory>
<excludes>
<exclude>**/*.java</exclude>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<finalName>ServiceCreate</finalName>
<appendAssemblyId>false</appendAssemblyId>
<archive>
<manifest>
<mainClass>com.svt.optimoo.App</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<includes>
<include>**/*Test.java</include>
<include>**/Test*.java</include>
<include>**/When*.java</include>
<include>**/*Story.java</include>
</includes>
<argLine>-Xmx512m</argLine>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>net.serenity-bdd.maven.plugins</groupId>
<artifactId>serenity-maven-plugin</artifactId>
<version>${serenity.version}</version>
<executions>
<execution>
<id>serenity-reports</id>
<phase>post-integration-test</phase>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
It may be difficult to implement because of such things:
test sources are not included by default into jar since they placed in special directory, following maven`s Convention-Over-Configuration
every "runnable" jar must have the starter class with entry point (public static void main(String[] args) method)
especially integration tests (run by maven-failsafe-plugin) or their parts may use resources inside src/ dir, but not target/test-classes location, where static resources are placed by maven (serenity-maven-plugin does that for report generation)
Though all this points technically may be implemented I bielive, but there is no quarantee for repoduciable behaviour onto another machine with jar file.
Let me advice you to use CI tools, as tibor17 mentiones, or maybe hand-made script with smth like git clone <repo>; cd <repo>; mvn verify

How do I build 2 docker images from maven, in separate phases?

I use io.fabric8:docker-maven-plugin:0.28.0 in a Maven project and I need to build 2 different Docker images, in different phases:
One for the integration-test phase, to run some database for the integration tests. I would build it with some resources from the project (SQL files defining the schema).
One at the end, after the tests have passed (maybe during package), with the complete application.
My problem is that only the first image is built.
I tried to reference the image aliases in the <configuration> of the <execution> elements, but it doesn't seem to work. Only the first image is considered:
$ mvn install
...
[INFO] --- docker-maven-plugin:0.28.0:build (start) # dmp-example ---
[INFO] Building tar: /home/cosmin/workspaces/photon/test/dmp-example/target/docker/example/db-test/latest/tmp/docker-build.tar
[INFO] DOCKER> [example/db-test:latest] "example-db-test": Created docker-build.tar in 28 milliseconds
[INFO] DOCKER> [example/db-test:latest] "example-db-test": Built image sha256:d8233
[INFO]
[INFO] --- docker-maven-plugin:0.28.0:start (start) # dmp-example ---
[INFO] DOCKER> [example/db-test:latest] "example-db-test": Start container 47883d799641
[INFO]
[INFO] --- docker-maven-plugin:0.28.0:stop (stop) # dmp-example ---
[INFO] DOCKER> [example/db-test:latest] "example-db-test": Stop and removed container 47883d799641 after 0 ms
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # dmp-example ---
[INFO] Installing /home/cosmin/workspaces/photon/test/dmp-example/target/dmp-example-0.0.1-SNAPSHOT.jar to /home/cosmin/.m2/repository/com/example/dmp-example/0.0.1-SNAPSHOT/dmp-example-0.0.1-SNAPSHOT.jar
[INFO] Installing /home/cosmin/workspaces/photon/test/dmp-example/pom.xml to /home/cosmin/.m2/repository/com/example/dmp-example/0.0.1-SNAPSHOT/dmp-example-0.0.1-SNAPSHOT.pom
[INFO]
[INFO] --- docker-maven-plugin:0.28.0:build (build) # dmp-example ---
[INFO] Building tar: /home/cosmin/workspaces/photon/test/dmp-example/target/docker/example/db-test/latest/tmp/docker-build.tar
[INFO] DOCKER> [example/db-test:latest] "example-packaged": Created docker-build.tar in 6 milliseconds
[INFO] DOCKER> [example/db-test:latest] "example-packaged": Built image sha256:d8233
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
...
The second image is not created, and the ID of the first one is also used when the second one should be built:
$ docker images "example/*"
REPOSITORY TAG IMAGE ID CREATED SIZE
example/db-test latest d8233ab899d4 7 days ago 1.2MB
Would there be another way of doing it?
This is my 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>com.example</groupId>
<artifactId>dmp-example</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.28.0</version>
<configuration>
<images>
<image>
<alias>example-db-test</alias>
<name>example/db-test:latest</name>
<build>
<from>busybox</from>
</build>
</image>
<image>
<alias>example-packaged</alias>
<name>example/packaged:latest</name>
<build>
<from>alpine</from>
</build>
</image>
</images>
</configuration>
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<configuration>
<images>
<image>
<alias>example-db-test</alias>
</image>
</images>
</configuration>
<goals>
<goal>build</goal>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<configuration>
<images>
<image>
<alias>example-db-test</alias>
</image>
</images>
</configuration>
<goals>
<goal>stop</goal>
</goals>
</execution>
<execution>
<id>build</id>
<phase>package</phase>
<configuration>
<images>
<image>
<alias>example-packaged</alias>
</image>
</images>
</configuration>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
For keeping the example simple, I used busybox and alpine as the base images, but that has no relevance.
Try moving the full configuration for the image you want into the execution, instead of using global plugin config.
<execution>
<id>build</id>
<phase>package</phase>
<configuration>
<images>
<image>
<alias>example-packaged</alias>
<name>example/packaged:latest</name>
<build>
<from>alpine</from>
</build>
</image>
</images>
</configuration>
<goals>
<goal>build</goal>
</goals>
</execution>

Build Failure creating Maven Zip for AWS device Farm

I'm getting a build failure when trying to create a zip for my Appium/selenium project. Any help would be appreciated.
I’m running this on MacOS HighSierra. I’m running this on MacOS HighSierra. Appium is version v1.10.1. The command I used to zip the file (or tried to use to zip the file) is in the first line from the terminal.This is the log from terminal:
cvarl-0046:powerleyappiumcucumber cvarl$ mvn clean package -DskipTests=true
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building TestngCucumberBoilerPlate 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # TestngCucumberBoilerPlate ---
[INFO] Deleting /Users/cvarl/Documents/PowerleyAppiumCucumber/target
[INFO]
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) # TestngCucumberBoilerPlate ---
[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] skip non existing resourceDirectory /Users/cvarl/Documents/PowerleyAppiumCucumber/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) # TestngCucumberBoilerPlate ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.7:testResources (default-testResources) # TestngCucumberBoilerPlate ---
[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 13 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) # TestngCucumberBoilerPlate ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 49 source files to /Users/cvarl/Documents/PowerleyAppiumCucumber/target/test-classes
[INFO] /Users/cvarl/Documents/PowerleyAppiumCucumber/src/test/java/main/CucumberRunner.java: Some input files use unchecked or unsafe operations.
[INFO] /Users/cvarl/Documents/PowerleyAppiumCucumber/src/test/java/main/CucumberRunner.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) # TestngCucumberBoilerPlate ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:3.1.1:jar (default-jar) # TestngCucumberBoilerPlate ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: /Users/cvarl/Documents/PowerleyAppiumCucumber/target/TestngCucumberBoilerPlate-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- maven-assembly-plugin:2.5.4:single (default) # TestngCucumberBoilerPlate ---
[INFO] Reading assembly descriptor: src/main/assembly/zip.xml
[INFO] Building zip: /Users/cvarl/Documents/PowerleyAppiumCucumber/target/zip-with-dependencies.zip
[INFO]
[INFO] --- maven-dependency-plugin:3.1.1:copy (copy) # TestngCucumberBoilerPlate ---
[INFO] Configured Artifact: appiumcucumber:appiumcucumberproj:1:.zip
Downloading: https://github.com/igniteram/appiumcucumber/appiumcucumberproj/1/appiumcucumberproj-1.pom
Downloading: https://repo.maven.apache.org/maven2/appiumcucumber/appiumcucumberproj/1/appiumcucumberproj-1.pom
[WARNING] The POM for appiumcucumber:appiumcucumberproj:.zip:1 is missing, no dependency information available
Downloading: https://github.com/igniteram/appiumcucumber/appiumcucumberproj/1/appiumcucumberproj-1..zip
Downloading: https://repo.maven.apache.org/maven2/appiumcucumber/appiumcucumberproj/1/appiumcucumberproj-1..zip
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.379 s
[INFO] Finished at: 2019-02-06T17:03:10-05:00
[INFO] Final Memory: 25M/94M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.1.1:copy (copy) on project TestngCucumberBoilerPlate: Unable to find/resolve artifact. Could not find artifact appiumcucumber:appiumcucumberproj:.zip:1 in TestNG-Cucumber (https://github.com/igniteram) -> [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/MojoExecutionException
cvarl-0046:powerleyappiumcucumber cvarl$
This is my 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">
<repositories>
<repository>
<id>TestNG-Cucumber</id>
<name>testng-cucumber</name>
<url>https://github.com/igniteram</url>
</repository>
</repositories>
<packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion>
<groupId>TestngCucumber</groupId>
<artifactId>TestngCucumberBoilerPlate</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-testng</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.1</version>
<type>maven-plugin</type>
</dependency>
<!-- Added for comparing screenshots -->
<!-- https://mvnrepository.com/artifact/com.sikulix/sikulixapi -->
<dependency>
<groupId>com.sikulix</groupId>
<artifactId>sikulixapi</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>zip-with-dependencies</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/zip.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>[ groupId ]</groupId>
<artifactId>[ artifactId ]</artifactId>
<version>[ version ]</version>
<type>[ packaging ]</type>
<classifier> [classifier - optional] </classifier>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/dependency-jars/</outputDirectory>
<destFileName>[ filename ]</destFileName>
</artifactItem>
</artifactItems>
<!-- other configurations here -->
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-filtering</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.1</version>
</plugin>
</plugins>
</build>
</project>
Changing out my maven-dependency-plugin in the pom.xml with the one below fixed my build failures.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/dependency-jars/</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>

mvn does not run test on appCenter

I want to run my appium test on AppCenter and I have followed this documents
https://learn.microsoft.com/en-us/appcenter/test-cloud/preparing-for-upload/appium#prerequisites
When I run appium script on appCenter it does not show any error but give me output as
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------
[INFO] Building run-test 1.0-SNAPSHOT
[INFO] ----------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # run-test ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # run-test ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # run-test ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # run-test ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.20:test (default-test) # run-test ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.testscripts.RegressionTest
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.247 s - in com.testscripts.RegressionTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # run-test ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: target/run-test-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-failsafe-plugin:2.20:integration-test (default) # run-test ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! The file encoding for reports output files should be provided by the POM property ${project.reporting.outputEncoding}.
[INFO]
[INFO] --- maven-failsafe-plugin:2.20:verify (default) # run-test ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.623 s
[INFO] Finished at: 2018-08-06T07:39:58+02:00
[INFO] Final Memory: 17M/214M
[INFO] ------------------------------------------------------------------------
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>Cure.fit</groupId>
<artifactId>Cure.fit</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Automation Test Project</name>
<description>Automation Test Project</description>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.appium/java-client -->
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>6.1.0</version>
</dependency>
<dependency>
<groupId>com.microsoft.appcenter</groupId>
<artifactId>appium-test-extension</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>jcenter</id>
<url>https://jcenter.bintray.com/</url>
</repository>
</repositories>
<profiles>
<profile>
<id>repl</id>
<dependencies>
<dependency>
<groupId>com.javarepl</groupId>
<artifactId>javarepl</artifactId>
<version>428</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<executable>java</executable>
<classpathScope>test</classpathScope>
<arguments>
<argument>-Djansi.passthrough=true</argument>
<argument>-classpath</argument>
<classpath />
<argument>javarepl.Main</argument>
</arguments>
</configuration>
<executions>
<execution>
<id>runRepl</id>
<phase>process-test-classes</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- Added for AppCenter/Test runs -->
<profile>
<id>prepare-for-upload</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/upload/dependency-jars/</outputDirectory>
<useRepositoryLayout>true</useRepositoryLayout>
<copyPom>true</copyPom>
<addParentPoms>true</addParentPoms>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-help-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>generate-pom</id>
<phase>package</phase>
<goals>
<goal>effective-pom</goal>
</goals>
<configuration>
<output>${project.build.directory}/upload/pom.xml</output>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-testclasses</id>
<phase>package</phase>
<goals>
<goal>testResources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/upload/test-classes</outputDirectory>
<resources>
<resource>
<directory>
${project.build.testOutputDirectory}
</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
When I run the same project as mvn test I am able to run the test.
I have kept my JUnit testcase name as RegressionTest.java under src/test/java which extends Support.java which is also Junit file.
Could any one can help me what is the mistake I am doing.

Maven pom.xml with more than one jar with version

Here is my pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<url>http://maven.apache.org</url>
<name>SomeProject</name>
<groupId>com.test.te</groupId>
<artifactId>testjar</artifactId>
<version>1.1.6</version>
<packaging>jar</packaging>
<dependencies>
....
....
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.conf</include>
<include>**/*.java</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
<executions>
<execution>
<id>drive</id>
<goals><goal>jar</goal></goals>
<phase>install</phase>
<configuration>
<finalName>driver</finalName>
<includes>
<include>com/test/te/p1/*.java<include>
<include>com/test/te/p1/*.class</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Here is how I am executing this
mvn clean install
Here is the build output's last few lines.
[INFO] [jar:jar {execution: default-jar}]
[INFO] Building jar: /home/mycp/workspace/SomeProject/target/testjar-1.1.6.jar
[INFO] [install:install {execution: default-install}]
[INFO] Installing /home/mycp/workspace/SomeProject/target/testjar-1.1.6.jar to /home/mycp/.m2/repository/com/test/te/testjar/1.1.6/testjar-1.1.6.jar
[INFO] [jar:jar {execution: driver}]
[INFO] Building jar: /home/mycp/workspace/TestProject/target/driver.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11 seconds
[INFO] Finished at: Wed Oct 28 17:27:10 IST 2015
[INFO] Final Memory: 129M/888M
[INFO] ------------------------------------------------------------------------
Why the 2nd jar (driver.jar) is not versioned (driver-1.1.6.jar) ?
Why the 2nd jar not installed in local repo?
How to do this?
My requirement is create two jars testjar-${project.version}.jar driver-${project.version}.jar and install those two in two different artifact
/home/mycp/.m2/repossitory/com/test/te/testjar/${project-version}/testjar-${project.version}.jar
/home/mycp/.m2/repossitory/com/test/te/driver/${project-version}/driver-${project.version}.jar
Why the 2nd jar (driver.jar) is not versioned (driver-1.1.6.jar) ?
That is because you explicitely told the maven-jar-plugin that its name should be driver with <finalName>driver</finalName>. If you want to the version to be appended, you will need to have the following configuration: <finalName>driver-${project.version}</finalName>.
Why the 2nd jar not installed in local repo?
That is because you have specified a phase of <phase>install</phase>, so it will executed after the default-install execution, which is the execution that installs artefact to the local repository. Instead, you should bind that execution to the package phase.
This is the configuration you should have for the maven-jar-plugin. A classifier is needed to create another jar.
<execution>
<id>drive</id>
<goals>
<goal>jar</goal>
</goals>
<phase>package</phase>
<configuration>
<finalName>driver-${project.version}</finalName>
<classifier>classifier</classifier>
<includes>
<include>com/test/te/p1/*.java</include>
<include>com/test/te/p1/*.class</include>
</includes>
</configuration>
</execution>
As a side note, I noticed that you also configured a <resources> element in your POM including Java and conf files. You should not have that. More specifically: all the resources should be placed under src/main/resources and all Java files under src/main/java. Then there is no need for that configuration.
Following from the comments, if you can't add a classifier, then you have to drop maven-jar-plugin and use maven-assembly-plugin instead. This is a simple assembly descriptor that will get you started. Place this file under src/main/assembly/assembly.xml.
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<id>driver</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<useProjectArtifact>true</useProjectArtifact>
<unpackOptions>
<includes>
<include>com/test/te/p1/*.class</include>
</includes>
</unpackOptions>
<unpack>true</unpack>
</dependencySet>
</dependencySets>
</assembly>
with the following configuration in the POM:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.5</version>
<configuration>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor> <!-- point to the location of the assembly.xml file in your project structure -->
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
<finalName>driver-${project.version}</finalName>
</configuration>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>

Resources