Selenium-TestNG-Maven – Getting “java.lang.NoClassDefFoundError: org/openqa/selenium/firefox/FirefoxDriver”

What is NoClassDefFoundError NoClassDefFoundError in Java occurs when JVM is not able to find a particular class at runtime which was available at compile time. For example, if we have resolved a method call from a Class or accessing any static member of a Class and that Class is not available during runtime then JVM … Read more

Run JUnit Tests contained in dependency jar using Maven Surefire

There is a way of running a test in maven from another jar. from maven-surefire-plugin version 2.15 you can tell maven to scan your test jars for tests and run them. You don’t need to extract the tests jar. Just add a dependency to your test jar and: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <dependenciesToScan> <dependency>test.jar.group:test.jar.artifact.id</dependency> </dependenciesToScan> … Read more

Is Maven ready for JDK9?

Here is the answer from one Maven PMC member (me): No, it is not. Robert Scholte is working on it. Jigsaw and other stuff introduced a lot of changes. There is no official timeframe where full compat (Maven + official plugins) will be given. The issue you see is actually not Maven but Plexus Archiver. … Read more

How to override maven property in command line?

See Introduction to the POM finalName is created as: <build> <finalName>${project.artifactId}-${project.version}</finalName> </build> One of the solutions is to add own property: <properties> <finalName>${project.artifactId}-${project.version}</finalName> </properties> <build> <finalName>${finalName}</finalName> </build> And now try: mvn -DfinalName=build clean package

Gradle build.gradle to Maven pom.xml

Since Gradle 7, when using Gradle’s Maven-Publish plugin, publishToMavenLocal and publish are automatically added to your tasks, and calling either will always generate a POM file. So if your build.gradle file looks like this: plugins { id ‘java’ id ‘maven-publish’ } repositories { mavenCentral() } dependencies { implementation group: ‘org.slf4j’, name: ‘slf4j-api’, version: ‘1.7.25’ runtimeOnly … Read more

Maven Jacoco Configuration – Exclude classes/packages from report not working

Your XML is slightly wrong, you need to add any class exclusions within an excludes parent field, so your above configuration should look like the following as per the Jacoco docs <configuration> <excludes> <exclude>**/*Config.*</exclude> <exclude>**/*Dev.*</exclude> </excludes> </configuration> The values of the exclude fields should be class paths (not package names) of the compiled classes relative … Read more