Maven error in eclipse (pom.xml) : Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4

You need just to follow those steps: Right Click on your project: Run (As) -> Maven clean Right Click on your project: Run (As) -> Maven install After which, if the build fails when you do Maven Install, it means there is no web.xml file under WEB-INF or some problem associated with it. it really … Read more

How to pass java code a parameter from maven for testing

This is the exact thing I was looking for my automation test and I got it working. Command Line argument mvn clean test -Denv.USER=UAT -Dgroups=Sniff My Pom Xml <?xml version=”1.0″ encoding=”UTF-8″?> <project xmlns=”″ xmlns:xsi=”” xsi:schemaLocation=””> <modelVersion>4.0.0</modelVersion> <groupId>TestNg</groupId> <artifactId>TestNg</artifactId> <version>1.0</version> <dependencies> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>6.8</version> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.12.4</version> <configuration> … Read more

pom.xml environment variable with default fallback

I wasn’t really satisfied with the accepted approach, so I simplified it a little. Basically set a default property in the normal properties block, and only override when appropriate (instead of an effective switch statement): <properties> <!– Sane default –> <buildNumber>0</buildNumber> <!– the other props you use –> </properties> <profiles> <profile> <id>ci</id> <activation> <property> <name>env.buildNumber</name> … Read more

XMLStarlet does not select anything

UPDATE: since version 1.5 the default namespace prefix ‘_’ is available so the solution is reduced to this: xml sel -t -m _:project -v _:groupId -o : -v _:artifactId -o : -v _:version pom.xml Thanks @JamieNelson for the heads-up. Unfortunately, XMLStarlet is very picky about the default namespace. If the document has it declared (xmlns=), … Read more

How to execute a maven plugin twice with different property

Given the simple Maven Source Plugin configuration (as an example) you have a shared configuration across all of its executions (outside the executions element) and then a custom configuration per each execution, for the same phase, as requested by your question: <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version>2.4</version> <configuration> <includePom>true</includePom> </configuration> <executions> <execution> <id>test-id1</id> <phase>verify</phase> <goals> … Read more