It could sound dumb. But is there a way to edit or update the default-bindings file of maven?
/META-INF/plexus/default-bindings.xml
Why would I want to do that?
Background -
I am using latest
maven version 3.3.9
on my machine as a home directory within intelliJ.I have a module named
testng-test
without any external plugin specified. Take a look at thepom.xml
for the module :<artifactId>testng</artifactId> <dependencies> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>6.9.13.6</version> </dependency> </dependencies>
And another module named
junit-test
with similar pom.xml but different dependency as follows :<artifactId>junit</artifactId> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> </dependency> </dependencies>
I have added two empty classes within these modules(no @Test methods or classes still).
Activity -
- Now when I try to build each of these modules using
mvn clean install
, the modulejunit-test
builds successfully, but the moduletestng-test
fails with following logs :
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ testng ---
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ testng ---
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ testng ---
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ testng ---
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ testng ---
and then it would run into SurefireReflectionException
-
Running TestNG6 org.apache.maven.surefire.util.SurefireReflectionException: java.lang.reflect.InvocationTargetException; nested exception is java.lang.reflect.InvocationTargetException: null java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75) Caused by: org.apache.maven.surefire.testset.TestSetFailedException: Unknown TestNG version 6.9.13.6
Tried -
To what I have noticed, if I explicitly update the plugin version for maven-surefire-plugin
to 2.19.1
in the <plugins>
property, things would just work fine.
But what if I would not want to explicitly override the plugin versions for the projects, in such case how do I go around using the latest bindings(atleast those would fix) for my project?
Looking into the default bindings, I could see in the source code that
the bindings are in the default-bindings.xml
file for maven, but I am unable to find it inside my installed maven folder either to be possible to edit and update.
So is there a way I can choose the default bindings to pick up (by default) the plugin versions I would want to specify for any maven module on my project list to execute with?