is there possible to have maven version check in POM, to make a maven project download a plugin only if maven 2?

StackOverflow https://stackoverflow.com/questions/5820393

Question

The problem is that Maven 3 seems to support the spock-maven plugin native, but maven 2 requires the spock-maven plugin. With Maven 3 however, building the project fails when maven-spock plugin is included.

In my team, some of the guys have not yet switched to Maven 3, so I need this POM to build with both Maven versions.

Was it helpful?

Solution

Spock works just fine without the spock-maven plugin, both with Maven 2 and Maven 3. The plugin is completely optional and enables some advanced features like being able to use any class name for Spock specifications, freeing you from the Maven Surefire naming conventions (*Test etc.). Unfortunately, the plugin cannot be made to work with Maven 3.

To sum up, the solution is to remove the plugin and, if necessary, rename existing Spock specifications to adhere to the usual test class naming conventions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top