Maven is not downloading a plugin : jetspeed-unpack-maven-plugin - maven

so I made this pom :
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.mssb.ocr</groupId>
<artifactId>tesseractOcr</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<build>
<plugins>
<!-- autorun unit tests during maven compilation -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<argLine>-Xmx1024m -XX:MaxPermSize=256m -XX:-UseSplitVerifier</argLine>
<skipTests>-DskipTests</skipTests>
</configuration>
</plugin>
<!--
this extract the 32 bits dll and the tesseractdata folder to
the project root from tess4j.jar
-->
<plugin>
<groupId>org.apache.portals.jetspeed-2</groupId>
<artifactId>jetspeed-unpack-maven-plugin</artifactId>
<version>2.2.2</version>
<configuration>
<unpack>
<artifact>net.sourceforge.tess4j:tess4j:jar</artifact>
<overwrite>true</overwrite>
<resources combine.children="append">
<resource>
<path>win32-x86</path>
<destination>${basedir}</destination>
<overwrite>true</overwrite>
<flat>true</flat>
<include>*</include>
</resource>
<resource>
<path>tessdata</path>
<destination>${basedir}</destination>
<overwrite>true</overwrite>
<flat>false</flat>
<include>*</include>
</resource>
</resources>
</unpack>
<verbose>true</verbose>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!--
Log4j 2 is broken up in an API and an implementation (core), where the API
provides the interface that applications should code to. Strictly speaking
Log4j core is only needed at runtime and not at compile time.
However, below we list Log4j core as a compile time dependency to improve
the startup time for custom plugins.
-->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.1</version>
</dependency>
<!--
Integration of tesseract OCR
-->
<dependency>
<groupId>net.sourceforge.tess4j</groupId>
<artifactId>tess4j</artifactId>
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
mvn clean install and eclipse:eclipse both end up in a "SUCCESS" however the jeetspeed plugin does nothing, I don't see him doing anything in the console when building and he his not even in my local repository.
Yes, I added maven central to my maven conf file (http://repo1.maven.org/maven2/)
I'm using maven 3.2.1
What could I do?
Thanks
EDIT
mvn clean install
D:\!2015 repo\TTsXXJava>mvn clean install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] capcha solver
[INFO] tesseract ocr project
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building capcha solver 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # parent ---
[INFO] Deleting D:\!2015 repo\TTsXXJava\target
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # parent ---
[INFO] Installing D:\!2015 repo\TTsXXJava\pom.xml to d:\.m2\fr\mssb\capcha\parent\1.0\parent-1.0.pom
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building tesseract ocr project 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # tesseractOcr ---
[INFO] Deleting D:\!2015 repo\TTsXXJava\capcha-solver\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # tesseractOcr ---
[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:3.2:compile (default-compile) # tesseractOcr ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 1 source file to D:\!2015 repo\TTsXXJava\capcha-solver\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # tesseractOcr ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) # tesseractOcr ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) # tesseractOcr ---
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # tesseractOcr ---
[INFO] Building jar: D:\!2015 repo\TTsXXJava\capcha-solver\target\tesseractOcr-1.0.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # tesseractOcr ---
[INFO] Installing D:\!2015 repo\TTsXXJava\capcha-solver\target\tesseractOcr-1.0.jar to d:\.m2\fr\mssb\capcha\tesseractOcr\1.0\tesseractOcr-1.0.jar
[INFO] Installing D:\!2015 repo\TTsXXJava\capcha-solver\pom.xml to d:\.m2\fr\mssb\capcha\tesseractOcr\1.0\tesseractOcr-1.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] capcha solver ..................................... SUCCESS [ 0.381 s]
[INFO] tesseract ocr project ............................. SUCCESS [ 1.910 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.424 s
[INFO] Finished at: 2015-02-05T12:52:22+01:00
[INFO] Final Memory: 14M/231M
[INFO] ------------------------------------------------------------------------
mvn eclipse:eclipse
$ mvn eclipse:eclipse
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] capcha solver
[INFO] tesseract ocr project
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building capcha solver 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-eclipse-plugin:2.5.1:eclipse (default-cli) # parent >>>
[INFO]
[INFO] <<< maven-eclipse-plugin:2.5.1:eclipse (default-cli) # parent <<<
[INFO]
[INFO] --- maven-eclipse-plugin:2.5.1:eclipse (default-cli) # parent ---
[INFO] Not running eclipse plugin goal for pom project
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building tesseract ocr project 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-eclipse-plugin:2.5.1:eclipse (default-cli) # tesseractOcr >>>
[INFO]
[INFO] <<< maven-eclipse-plugin:2.5.1:eclipse (default-cli) # tesseractOcr <<<
[INFO]
[INFO] --- maven-eclipse-plugin:2.5.1:eclipse (default-cli) # tesseractOcr ---
[INFO] Using as WTP server : null
[INFO] Using source status cache: D:\!2015 repo\TTsXXJava\target\mvn-eclipse-cache.properties
[INFO] File D:\!2015 repo\TTsXXJava\capcha-solver\.project already exists.
Additional settings will be preserved, run mvn eclipse:clean if you want old settings to be removed.
[INFO] Wrote Eclipse project for "tesseractOcr" to D:\!2015 repo\TTsXXJava\capcha-solver.
[INFO]
Javadoc for some artifacts is not available.
List of artifacts without a javadoc archive:
o com.sun.jna:jna:3.0.9
o net.java.dev.jai-imageio:jai-imageio-core-standalone:1.2-pre-dr-b04-2011-07-04
o log4j:log4j:1.2.15
o commons-io:commons-io:1.3.1
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] capcha solver ..................................... SUCCESS [ 0.962 s]
[INFO] tesseract ocr project ............................. SUCCESS [ 0.406 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.698 s
[INFO] Finished at: 2015-02-05T12:42:36+01:00
[INFO] Final Memory: 7M/183M
[INFO] ------------------------------------------------------------------------
Parent pom in case you need it (I remove the parent reference in the originaly posted pom)
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fr.mssb.capcha</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<name>capcha solver</name>
<modules>
<module>capcha-solver</module>
</modules>
<build>
<plugins>
<!-- All project will be interpreted (source) and compiled (target) in java 7 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<!-- this will make eclipse:eclipse goal work and make the project Eclipse compatible -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
<classpathContainers>
<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7</classpathContainer>
</classpathContainers>
<additionalBuildcommands>
<buildcommand>net.sf.eclipsecs.core.CheckstyleBuilder</buildcommand>
</additionalBuildcommands>
<additionalProjectnatures>
<projectnature>net.sf.eclipsecs.core.CheckstyleNature</projectnature>
</additionalProjectnatures>
</configuration>
</plugin>
</plugins>
</build>
</project>

It is not doing anything because you have not bound any execution of the plugin to a lifecycle phase. You need to add a block like this:
<plugin>
<executions>
<execution>
<id>unpack-step</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
...
</configuration>
</executions>
</plugin>
See http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference for the possible lifecycle phases you can use.

Related

maven doesn't package the compiled source files

I have the following in my pom.xml
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
The only classes found in the 0.0.1-SNAPSHOT.jar are from
org.springframework.boot.loader package. None of the class files
compiled from my source files is there. Below is the output of maven
install:
INFO] --------------------< com.stocktrader:stock-trader
-------------------- [INFO] Building stock-trader 0.0.1-SNAPSHOT [INFO] --------------------------------[ jar
]--------------------------------- [INFO] [INFO] ---
build-helper-maven-plugin:3.0.0:add-source (default) # stock-trader
--- [INFO] Source directory: C:\Users\kannanj\IdeaProjects\ibkr\src\main\java added. [INFO] [INFO]
--- maven-resources-plugin:3.2.0:resources (default-resources) # stock-trader --- [INFO] Using 'UTF-8' encoding to copy filtered
resources. [INFO] Using 'UTF-8' encoding to copy filtered properties
files. [INFO] Copying 1 resource [INFO] Copying 3 resources [INFO]
[INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) #
stock-trader --- [INFO] Nothing to compile - all classes are up to
date [INFO] [INFO] --- maven-resources-plugin:3.2.0:testResources
(default-testResources) # stock-trader --- [INFO] Using 'UTF-8'
encoding to copy filtered resources. [INFO] Using 'UTF-8' encoding to
copy filtered properties files. [INFO] skip non existing
resourceDirectory
C:\Users\kannanj\IdeaProjects\ibkr\src\test\resources [INFO] [INFO]
--- maven-compiler-plugin:3.10.1:testCompile (default-testCompile) # stock-trader --- [INFO] Nothing to compile - all classes are up to
date [INFO] [INFO] --- maven-surefire-plugin:2.22.2:test
(default-test) # stock-trader --- [INFO] Tests are skipped. [INFO]
[INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) # stock-trader ---
[INFO] Building jar:
C:\Users\kannanj\IdeaProjects\ibkr\target\stock-trader-0.0.1-SNAPSHOT.jar
[INFO] [INFO] --- spring-boot-maven-plugin:2.7.0:repackage
(repackage) # stock-trader --- [INFO] Replacing main artifact with
repackaged archive [INFO] [INFO] ---
maven-install-plugin:2.5.2:install (default-install) # stock-trader
--- [INFO] Installing C:\Users\kannanj\IdeaProjects\ibkr\target\stock-trader-0.0.1-SNAPSHOT.jar
to
C:\Users\kannanj.m2\repository\com\stocktrader\stock-trader\0.0.1-SNAPSHOT\stock-trader-0.0.1-SNAPSHOT.jar
[INFO] Installing C:\Users\kannanj\IdeaProjects\ibkr\pom.xml to
C:\Users\kannanj.m2\repository\com\stocktrader\stock-trader\0.0.1-SNAPSHOT\stock-trader-0.0.1-SNAPSHOT.pom
[INFO]
------------------------------------------------------------------------ [INFO] BUILD SUCCESS
Please help before I shoot myself.
If you want to use some common parts in another project there are two possible solutions.
First make a multi module build and separate the common from the other parts. The commons part will be a simple jar (also possible with some spring support)
Create a complete separate standalone project and consume that.

-Dcucumber.options ignored with mvn test

I'm using "mvn test" to run cucumber tests, but when I try to pass options on the command line with
-Dcucumber.options=..., the options are ignored and the ones specified in #CucumberOptions in the runner class are used instead. For example, if I just try to display cucumber help, it ignores it and just runs the tests:
C:\Maven\ArchCuke\untitled>mvn test -Dcucumber.options="--help"
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< org.example:untitled >------------------------
[INFO] Building untitled 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # untitled ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Maven\ArchCuke\untitled\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) # untitled ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # untitled ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) # untitled ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to C:\Maven\ArchCuke\untitled\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) # untitled ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.example.steps.CucumberTestRunner
Scenario: Add two numbers # features/arith.feature:4
Given A Calculator # org.example.steps.ArithSteps.aCalculator()
When I add 2 and 2 # org.example.steps.ArithSteps.iAddAnd(int,int)
Then I get 4 # org.example.steps.ArithSteps.iGet(int)
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.253 s - in org.example.steps.CucumberTestRunner
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.815 s
[INFO] Finished at: 2020-11-05T10:51:50-08:00
[INFO] ------------------------------------------------------------------------
C:\Maven\ArchCuke\untitled>
This is my runner class
package org.example.steps;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
#RunWith(Cucumber.class)
#CucumberOptions(
features = {"classpath:features"},
plugin = {"pretty"}
)
public class CucumberTestRunner {
}
and this is my pom.xml.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>untitled</artifactId>
<version>1.0-SNAPSHOT</version>
<name>untitled</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<junit.version>4.13</junit.version>
<cucumber.version>6.8.0</cucumber.version>
<maven.compiler.version>3.8.1</maven.compiler.version>
<maven.surefire.version>2.22.2</maven.surefire.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.version}</version>
<configuration>
<encoding>UTF-8</encoding>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.version}</version>
<!-- Include our runner class or 'mvn test' won't work; name doesn't match default template.
See https://maven.apache.org/surefire/maven-surefire-plugin/examples/inclusion-exclusion.html -->
<configuration>
<includes>
<include>CucumberTestRunner.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</project>
I tried version 3.0.0-M5 of the surefire plugin instead of 2.22.2, with the same results.
What am I doing wrong here?
The cucumber.options property was deprecated and removed. You have to pass each option as a single property.
mvn test -Dcucumber.filter.tags='#smoke and not #ignore'
https://github.com/cucumber/cucumber-jvm/blob/main/release-notes/v5.0.0.md#property-based-options
You should not use the system property directly in your CLI. You should deliver the system property to the surefire subprocess
mvn test "-DargLine=-Dcucumber.filter.tags='#smoke and not #ignore'"
or make a little trick in your POM and then use your original CLI:
<properties>
<argLine>-Dcucumber.filter.tags='${cucumber.filter.tags}'</argLine>
</properties>

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.

maven-surefire-plugin ignores plugins order in pom.xml

I have multimodule maven project. This project contains self written maven plugin and test project for this plugin.
I want to run my plugin in test phase before maven-surefire-plugin
I put maven-surefire-plugin after my plugin in pom.xml
<build>
<plugins>
<plugin>
<groupId>com.my.group</groupId>
<artifactId>validator-maven-plugin</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>validate</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</build>
But maven-surefire-plugin still runs first.
[INFO] ------------------------------------------------------------------------
[INFO] Building PC_TEST_PROJECT 0.23-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # PC_TEST_PROJECT ---
[INFO] Deleting C:\validator\PC_TEST_PROJECT\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # PC_TEST_PROJECT ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\validator\PC_TEST_PROJECT\src\main\java
[INFO] skip non existing resourceDirectory C:\validator\PC_TEST_PROJECT\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # PC_TEST_PROJECT ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # PC_TEST_PROJECT ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # PC_TEST_PROJECT ---
[INFO] Compiling 1 source file to C:\validator\PC_TEST_PROJECT\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) # PC_TEST_PROJECT ---
[INFO] Surefire report directory: C:\validator\PC_TEST_PROJECT\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.my.group.validator.MainTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.657 sec - in com.my.group.validator.MainTest
Results :
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] >>> validator-maven-plugin:0.23-SNAPSHOT:validate (default) > test # PC_TEST_PROJECT >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # PC_TEST_PROJECT ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\validator\PC_TEST_PROJECT\src\main\java
[INFO] skip non existing resourceDirectory C:\validator\PC_TEST_PROJECT\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # PC_TEST_PROJECT ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # PC_TEST_PROJECT ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # PC_TEST_PROJECT ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) # PC_TEST_PROJECT ---
[INFO] Skipping execution of surefire because it has already been run for this configuration
[INFO]
[INFO] --- maven-surefire-plugin:2.18.1:test (default) # PC_TEST_PROJECT ---
[INFO] Skipping execution of surefire because it has already been run for this configuration
[INFO]
[INFO] <<< validator-maven-plugin:0.23-SNAPSHOT:validate (default) < test # PC_TEST_PROJECT <<<
[INFO]
[INFO] --- validator-maven-plugin:0.23-SNAPSHOT:validate (default) # PC_TEST_PROJECT ---
[INFO]
[INFO] --- maven-surefire-plugin:2.18.1:test (default) # PC_TEST_PROJECT ---
[INFO] Skipping execution of surefire because it has already been run for this configuration
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] validator-parent ................................... SUCCESS [ 0.175 s]
[INFO] validator .......................................... SUCCESS [ 6.038 s]
[INFO] validator-maven-plugin ............................. SUCCESS [ 2.012 s]
[INFO] PC_TEST_PROJECT .................................... SUCCESS [ 2.762 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.298 s
[INFO] Finished at: 2015-07-05T00:46:59+03:00
[INFO] Final Memory: 21M/51M
[INFO] ------------------------------------------------------------------------
Is it expected behavior for maven-surefire-plugin?
How to change order of plugins execution?
try this one:
<?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>ch.stefanheimberg.stackoverflow</groupId>
<artifactId>stackoverflow-31225404</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>run-before-surfire</id>
<phase>test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo message=" !!!! THIS SHOULD RUN BEFORE SUREFIRE !!!! " />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>default-test</id>
<phase>none</phase>
</execution>
<execution>
<id>run-after-antrun</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
and the console output:
cd /Users/stefanheimberg/git/stackoverflow-31225404; JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home "/Applications/NetBeans/NetBeans 8.0.2.app/Contents/Resources/NetBeans/java/maven/bin/mvn" clean install
Scanning for projects...
Some problems were encountered while building the effective model for ch.stefanheimberg.stackoverflow:stackoverflow-31225404:jar:1.0-SNAPSHOT
'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. # line 31, column 21
It is highly recommended to fix these problems because they threaten the stability of your build.
For this reason, future Maven versions might no longer support building such malformed projects.
------------------------------------------------------------------------
Building stackoverflow-31225404 1.0-SNAPSHOT
------------------------------------------------------------------------
--- maven-clean-plugin:2.4.1:clean (default-clean) # stackoverflow-31225404 ---
Deleting /Users/stefanheimberg/git/stackoverflow-31225404/target
--- maven-resources-plugin:2.5:resources (default-resources) # stackoverflow-31225404 ---
[debug] execute contextualize
Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
skip non existing resourceDirectory /Users/stefanheimberg/git/stackoverflow-31225404/src/main/resources
--- maven-compiler-plugin:2.3.2:compile (default-compile) # stackoverflow-31225404 ---
No sources to compile
--- maven-resources-plugin:2.5:testResources (default-testResources) # stackoverflow-31225404 ---
[debug] execute contextualize
Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
skip non existing resourceDirectory /Users/stefanheimberg/git/stackoverflow-31225404/src/test/resources
--- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # stackoverflow-31225404 ---
No sources to compile
--- maven-antrun-plugin:1.3:run (run-before-surfire) # stackoverflow-31225404 ---
Executing tasks
[echo] !!!! THIS SHOULD RUN BEFORE SUREFIRE !!!!
Executed tasks
--- maven-surefire-plugin:2.10:test (run-after-antrun) # stackoverflow-31225404 ---
No tests to run.
Surefire report directory: /Users/stefanheimberg/git/stackoverflow-31225404/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
--- maven-jar-plugin:2.3.2:jar (default-jar) # stackoverflow-31225404 ---
JAR will be empty - no content was marked for inclusion!
Building jar: /Users/stefanheimberg/git/stackoverflow-31225404/target/stackoverflow-31225404-1.0-SNAPSHOT.jar
--- maven-install-plugin:2.3.1:install (default-install) # stackoverflow-31225404 ---
Installing /Users/stefanheimberg/git/stackoverflow-31225404/target/stackoverflow-31225404-1.0-SNAPSHOT.jar to /Users/stefanheimberg/.m2/repository/ch/stefanheimberg/stackoverflow/stackoverflow-31225404/1.0-SNAPSHOT/stackoverflow-31225404-1.0-SNAPSHOT.jar
Installing /Users/stefanheimberg/git/stackoverflow-31225404/pom.xml to /Users/stefanheimberg/.m2/repository/ch/stefanheimberg/stackoverflow/stackoverflow-31225404/1.0-SNAPSHOT/stackoverflow-31225404-1.0-SNAPSHOT.pom
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 1.888s
Finished at: Tue Jul 07 00:41:57 CEST 2015
Final Memory: 8M/155M
------------------------------------------------------------------------
the trick here is, to first bind your plugin (in my antrun) to the test phase, and after this, unbind the "default-test" phase. after this you can bind the maven-surfire to the test phase again.
In the same phase, maven should execute plugins in the same order as they are listed in the pom.xml. Update your maven version :
For maven 3, it is fixed since version 3.0.3.
For maven 2, it is fixed since versions 2.0.11 and 2.1.0

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