Reputation: 1
Hi I'm new to stackoverflow community, I'm learning maven for automation perspective. Here if I add maven surefire_report plugin as dependency in POM then I get
Exception in thread "main" java.lang.NoSuchMethodError: 'void com.google.common.base.Preconditions.checkState(boolean, java.lang.String, java.lang.Object, java.lang.Object, java.lang.Object)'
But It works fine when I mention the same within the plugin tags. So I wanted to understand
Do they have some rules for what can be defined as plugin and what goes as a dependency in POM?
Is it even possible to define plugin as dependency some how, as if mention maven surefire plugin in dependency it works fine every time?
<dependencies>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<type>maven-plugin</type>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>3.0.0-M4</version>
<type>maven-plugin</type>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.0.0-alpha-5</version>
</dependency>
2.3.2
org.apache.maven.plugins
maven-compiler-plugin
${maven-compiler-plugin-version}
1.8
1.8
Upvotes: 0
Views: 410
Reputation: 35823
Dependencies are those artifacts that your program will use for compilation and runtime.
Plugins are a different kettle of fish. They are run during the build to e.g. process resources, run tests etc.
So using the surefire plugin as dependency means that you want to use it in your program (not during the build). And this is probably not what you want.
Upvotes: 2