I'm trying to use JMeter maven plugin with private nexus repository without success. Here is the POM file
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
...
<repositories>
<repository>
<id>KKV nexus</id>
<url>http://kkv:8082/nexus/repository/maven-group</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>KKV nexus</id>
<url>http://kkv:8082/nexus/repository/maven-group</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.9.0</version>
<executions>
<!-- Run JMeter tests -->
<execution>
<id>jmeter-tests</id>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
<!-- Fail build on errors in test -->
<execution>
<id>jmeter-check-results</id>
<goals>
<goal>results</goal>
</goals>
</execution>
</executions>
<configuration>
<jmeterExtensions>
<artifacts>nz.co.breakpoint:jmeter-wssecurity:1.6</artifacts>
</jmeterExtensions>
</configuration>
</plugin>
</plugins>
</build>
</project>
I installed all the transitive dependencies in nexus, but the build still tries to connect maven central
[INFO] --- jmeter-maven-plugin:2.9.0:configure (configure) # 0-jarj-testi-liittyma ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] C O N F I G U R I N G J M E T E R
[INFO] -------------------------------------------------------
[INFO]
[INFO] Building JMeter directory structure...
[INFO] Configuring JMeter artifacts...
[INFO] Populating JMeter directory...
[INFO] Copying extensions to JMeter lib/ext directory C:\Projektit\kkv-e2e-testaus\0-jarj-testi-liittyma\target\jmeter\lib\ext with downloadExtensionDependencies set to true...
Downloading from central: https://repo.maven.apache.org/maven2/org/bouncycastle/bcprov-jdk15on/1.59/bcprov-jdk15on-1.59.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.020 s
[INFO] Finished at: 2019-07-18T13:25:59+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.lazerycode.jmeter:jmeter-maven-plugin:2.9.0:configure (configure) on project 0-jarj-testi-liittyma: Failed to collect dependencies at org.apache.wss4j:wss4j-ws-security-dom:jar:2.2.2 -> org.apache.wss4j:wss4j-ws-security-common:jar:2.2.2 -> org.opensaml:opensaml-saml-impl:jar:3.3.0 -> org.opensaml:opensaml-saml-api:jar:3.3.0 -> org.opensaml:opensaml-xmlsec-api:jar:3.3.0 -> org.opensaml:opensaml-security-api:jar:3.3.0 -> org.cryptacular:cryptacular:jar:1.1.1 -> org.bouncycastle:bcprov-jdk15on:jar:1.59: Failed to read artifact descriptor for org.bouncycastle:bcprov-jdk15on:jar:1.59: Could not transfer artifact org.bouncycastle:bcprov-jdk15on:pom:1.59 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org: Unknown host repo.maven.apache.org -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
How do I configure the plugin to use the nexus? Also, it's weird the missing dependency is bcprov-jdk15on:pom:1.59 as cryptacular-1.1.1.pom defines dependency version as 1.54
Usually, you define your company Nexus in the settings.xml. Using it as a mirror redirects all requests to it and avoids calls to MavenCentral (which may fail due to proxy/firewall restrictions). A standard example can be found at
https://github.com/sonatype/nexus-book-examples/blob/master/maven/settings/settings.xml
Note furthermore that the versions of dependencies may be different from the ones defined in (some of the) poms. You can have only one version of a dependency in your dependencies and if you have more than one, Maven will choose one for you, following various rules.
the jmeter-maven-plugin uses aether to resolve and download artifacts.
By default it should pull in all of the project repositories, it looks like adding additional ones via config is broken. I've just raised an issue here: https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/issues/350.
Related
I want to publish my projects artifacts with maven to nexus. Therefore I followed this documentation which works for me for artifacts which are also build with maven. But now I want to publish additional artifacts (*.tgz files) which I download from somewhere else. I have not yet found out how to express in maven terms that I want to deploy those "local" artifacts.
What I tried is:
Create a new staging repo on ossrh with the pom file. This works and a new, open staging repository is created containing the pom file and a signature file.
> mvn deploy -DrepositoryId=ossrh
upload additional resources. This fails
> mvn deploy:deploy-file -Dfile=test-tst-0.0.1_linux-ppc64le_bin.tar.gz -Dclassifier=linux-ppc64le -DrepositoryId=ossrh -Durl=https://s01.oss.sonatype.org/content/repositories/iosapmachine-1031 -DgroupId=io.sapmachine -DartifactId=test-tst -Dversion=0.0.1
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< io.sapmachine:test-tst >-----------------------
[INFO] Building io.sapmachine:test-tst 0.0.1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy-file (default-cli) # test-tst ---
Uploading to ossrh: https://s01.oss.sonatype.org/content/repositories/iosapmachine-1031/io/sapmachine/test-tst/0.0.1/test-tst-0.0.1-linux-ppc64le.gz
Uploading to ossrh: https://s01.oss.sonatype.org/content/repositories/iosapmachine-1031/io/sapmachine/test-tst/0.0.1/test-tst-0.0.1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.002 s
[INFO] Finished at: 2021-12-08T09:02:40+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default-cli) on project test-tst: Failed to deploy artifacts: Could not find artifact io.sapmachine:test-tst:gz:linux-ppc64le:0.0.1 in ossrh (https://s01.oss.sonatype.org/content/repositories/iosapmachine-1031) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
My pom.xml looks like this:
> cat pom.xml
<?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>io.sapmachine</groupId>
<artifactId>test-tst</artifactId>
<version>0.0.1</version>
<name>${project.groupId}:${project.artifactId}</name>
<description>Test</description>
<packaging>pom</packaging>
<modelVersion>4.0.0</modelVersion>
<url>https://test.io/</url>
<licenses>
<license>
<name>GPLv2 + Classpath Exception</name>
<url>https://test/LICENSE</url>
</license>
</licenses>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2</url>
</repository>
</distributionManagement>
<developers>
<developer>
<name>Test</name>
<email>test#test.com</email>
<organization>Test AG</organization>
<organizationUrl>http://www.test.com</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:https://github.com/test/tree/test-${project.version}</connection>
<url>http://github.com/test/tree/test-${project.version}</url>
</scm>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
>
I am trying to create a Maven repository for a project of mine.
The relevant lines in my project's pom.xml file are:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>edu.mills.cs180a</groupId>
<artifactId>spring-swagger-wordnik-client</artifactId>
<packaging>jar</packaging>
<name>spring-swagger-wordnik-client</name>
<version>0.0.2A-SNAPSHOT</version>
...
<distributionManagement>
<repository>
<id>CS180A site</id>
<url>file:///C:/Users/ellen/Dropbox/Apps/site44/www.spertus.com/cs180a</url>
</repository>
</distributionManagement>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
...
</plugins>
</project>
I get this error when I try to deploy the site:
$ mvn site:deploy
[INFO] Scanning for projects...
[INFO]
[INFO] -----------< edu.mills.cs180a:spring-swagger-wordnik-client >-----------
[INFO] Building spring-swagger-wordnik-client 0.0.2A-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-site-plugin:3.7.1:deploy (default-cli) # spring-swagger-wordnik-client ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.055 s
[INFO] Finished at: 2020-11-11T15:24:38-08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.7.1:deploy (default-cli) on project spring-swagger-wordnik-client: Missing site information in the distribution management of the project spring-swagger-wordnik-client (edu.mills.cs180a:spring-swagger-wordnik-client:0.0.2A-SNAPSHOT) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
I don't understand why I get this error:
Missing site information in the distribution management of the project spring-swagger-wordnik-client
What else should be in distribution management besides this?
<distributionManagement>
<repository>
<id>CS180A site</id>
<url>file:///C:/Users/ellen/Dropbox/Apps/site44/www.spertus.com/cs180a</url>
</repository>
</distributionManagement>
Looking at your configuration, you need to add element inside distributionManagement as explained here: https://maven.apache.org/plugins/maven-site-plugin/usage.html.
My goal is to add an external jar into my Maven-project. Running the project invokes an NoClassDefFoundError. So I did a little research to found out that possibly the external jar is not included in my created jar file.
Therefor I found the solution to use maven-shade-plugin, but I'm stuck a little because the project will not compile.
I've got the following pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>this.isa.test</groupId>
<artifactId>test</artifactId>
<version>0.0.1</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version><!--change this value depending on the version or use LATEST-->
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version><!--change this value depending on the version-->
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.0</version>
<type>maven-plugin</type>
</dependency>
</dependencies>
</project>
Note that maven-shade-plugin is referenced as a dependency and included as an plugin for the build. I'm compiling the project through the Eclipse IDE with the preinstalled maven integration like the following mvn-install.
The following Error messages will be given in the Console:
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for org.apache.maven.plugins:maven-shade-plugin:jar:3.2 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.195 s
[INFO] Finished at: 2018-09-30T09:48:43+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-shade-plugin:3.2 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugins:maven-shade-plugin:jar:3.2 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
To be honest, I'm a little overchallenged because it's my first attempt to use Maven. There are plenty of questions and answers here and all over the internet, but nothing seems to fit my situation.
I am not using Eclipse, but instead invoking maven from commandline - and for making the thing work, I would recommend the same to you.
Once you have maven build working, you can try the next challenge with Eclipse, which should not be hard anyway.
Your pom needs following fixes:
remove the shade plugin from dependencies; dependencies should contain only artifacts that are needed for javac to compile the project, in your case also artifacts needed in runtime, but never (with very few exceptions) maven tooling artifacts
fix the shade plugin version to 3.2.0 (you have it correctly in your dependency, but not in plugin declaration)
Then try mvn clean install on commandline (make sure you are in the same directory where your pom file exists) and it should work - at least it did for me.
I want to update jenkins selenium plugin (latest version: 2.53.1).
I can configure selenium hub and nodes outside of jenkins and run my automated tests with latest browser versions (firefox 51.0.1, chrome 55.0.2883.87) successfully but I just want to use jenkins as hub.
So that's why I'm trying to integrate the newest version of the selenium-server-standalone (3.0.1) into Jenkins but it's not working.
Getting this error messages:
[WARNING] The POM for org.jenkins-ci.tools:maven-hpi-plugin:jar:1.117 is missing, no dependency information available
[WARNING] Failed to build parent project for org.jenkins-ci.plugins:selenium:hpi:2.53.2-SNAPSHOT
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO]Building Jenkins Selenium Plugin 2.53.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-hpi-plugin:1.117:validate (default-validate) # selenium ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:display-info (display-info) # selenium ---
[INFO] Maven Version: 3.3.9
[INFO] JDK Version: 1.8.0_121 normalized as: 1.8.0-121
[INFO] OS Info: Arch: amd64 Family: unix Name: linux Version: 4.4.0-62-generic
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (display-info) # selenium ---
[INFO] Restricted to JDK 1.7 yet org.seleniumhq.selenium:selenium-server-standalone:jar:3.0.1:compile contains org/openqa/selenium/chrome/ChromeDriver.class targeted to JDK 1.8
[WARNING] Rule 2: org.apache.maven.plugins.enforcer.EnforceBytecodeVersion failed with message:
Found Banned Dependency: org.seleniumhq.selenium:selenium-server-standalone:jar:3.0.1
Use 'mvn dependency:tree' to locate the source of the banned dependencies.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 11.325 s
[INFO] Finished at: 2017-02-15T16:42:25+01:00
[INFO] Final Memory: 62M/1133M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.3.1:enforce (display-info) on project selenium: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
pom.xml of maven project:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fake</groupId>
<artifactId>fake</artifactId>
<packaging>pom</packaging>
<version>${selenium.version}</version>
<name>fake</name>
<properties>
<selenium.short.version>3.0</selenium.short.version>
<selenium.version>${selenium.short.version}.1</selenium.version>
<htmlunit.driver.version>2.20</htmlunit.driver.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<get
src="http://selenium-release.storage.googleapis.com/${selenium.short.version}/selenium-server-standalone-${selenium.version}.jar"
dest="${project.build.directory}/selenium-server-standalone-${selenium.version}.jar"
verbose="on" usetimestamp="true" />
<get
src="https://github.com/SeleniumHQ/htmlunit-driver/releases/download/${htmlunit.driver.version}/htmlunit-driver-standalone-${htmlunit.driver.version}.jar"
dest="${project.build.directory}/htmlunit-driver-standalone-${htmlunit.driver.version}.jar"
verbose="on" usetimestamp="true" />
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.1</version>
<executions>
<execution>
<id>selenium-server-standalone</id>
<phase>install</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<file>${project.build.directory}/selenium-server-standalone-${selenium.version}.jar</file>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server-standalone</artifactId>
<version>${selenium.version}</version>
<packaging>jar</packaging>
<localRepositoryPath>local_m2</localRepositoryPath>
</configuration>
</execution>
<execution>
<id>htmlunit-driver-standalone</id>
<phase>install</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<file>${project.build.directory}/htmlunit-driver-standalone-${htmlunit.driver.version}.jar</file>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver-standalone</artifactId>
<version>${htmlunit.driver.version}</version>
<packaging>jar</packaging>
<localRepositoryPath>local_m2</localRepositoryPath>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Code : https://github.com/jenkinsci/selenium-plugin
OS: Ubuntu 16.04.2; Eclipse Neon Java IDE ,openjdk version "1.8.0_121"
I've already tried it out with openjdk 1.7 as well but it's still not working.
I'm quite a newbie at this so I appreciate any help. Thanks a lot.
The root cause is simple : The Jenkins plugin's parent pom enforces by default to JDK7. Selenium libraries have moved on to using JDK8. That explains the error message arising from the enforcer plugin.
Here's how the enforcer plugin has been configured in the parent pom
<java.level>7</java.level>
<enforceBytecodeVersion>
<maxJdkVersion>1.${java.level}</maxJdkVersion>
<ignoredScopes>
<ignoredScope>test</ignoredScope>
</ignoredScopes>
<excludes>
<!-- Makes no sense to check core itself: -->
<exclude>org.jenkins-ci.main:jenkins-core</exclude>
<exclude>org.jenkins-ci.main:cli</exclude>
<exclude>org.jenkins-ci.main:jenkins-test-harness</exclude>
<!-- findbugs dep managed to provided and optional so is not shipped and missing annotations ok -->
<exclude>com.google.code.findbugs:annotations</exclude>
</excludes>
</enforceBytecodeVersion>
To fix this, you have two options [ I have never tried this, but its something that you can try and see if it helps ] (Both these options I am suggesting based on the recommendations from your parent pom itself )
Try passing the JVM argument -Djava.level=8 when you build the code.
Add an entry such as below to your pom file (This will cause enforcer plugin to perhaps ignore only the selenium libraries)
maven-enforcer-plugin
display-info
org.seleniumhq.selenium:selenium-java::jar:compile
org.seleniumhq.selenium:selenium-server::jar:compile
Hope that helps!
update
I spent more time looking at this and realised that moving over to selenium 3.0.1 for this plug-in was not very straight forward. I have tried doing the changes and raised a pull request for the same. You can take a look at the PR and see if that helps.
PS : I still have 3 tests failing in the PR. I haven't figured out how to get them to pass. But the PR should help you get started. You can directly checkout my branch and try building from there.
i created a simple maven java project on eclipse kepler.
I wrote a simple JUnit (version 4) test. I can run it from Eclipse, but not from the pom.xml (alt-click, Run as, Maven Test). I suppose I need to tell Maven to search for that class, but I just don't know how.
with default junit version 3.8.1, mvn test works fine but failing on only eclipse when changed to 4.11. this worked on command promt.
my pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.seleniumsimplified.webdriver</groupId>
<artifactId>webdriverbasics</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>webdriverbasics</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
error :
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/2.10/surefire-junit4-2.10.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.819s
[INFO] Finished at: Tue Feb 02 19:25:36 IST 2016
[INFO] Final Memory: 12M/210M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test) on project webdriverbasics: Unable to generate classpath: org.apache.maven.artifact.resolver.ArtifactResolutionException: Unable to get dependency information for org.apache.maven.surefire:surefire-junit4:jar:2.10: Failed to retrieve POM for org.apache.maven.surefire:surefire-junit4:jar:2.10: Could not transfer artifact org.apache.maven.surefire:surefire-junit4:pom:2.10 from/to central (http://repo.maven.apache.org/maven2): null to http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/2.10/surefire-junit4-2.10.pom
[ERROR] org.apache.maven.surefire:surefire-junit4:jar:2.10
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR] central (http://repo.maven.apache.org/maven2, releases=true, snapshots=false)
[ERROR] Path to dependency:
[ERROR] 1) dummy:dummy:jar:1.0: UnresolvedAddressException
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
workarounds that i tried :
1) tried adding <build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
</plugin>
</plugins>
</pluginManagement>
</build>
2) changed test file name from AppTest.java to TestApp.java
3) commented <scope>test</test>
4) selected Upgrade Maven project
but nothing is helping. i am new to Maven.
please guide. thanks in advance :)
By definition
pluginManagement: is an element that is seen along side plugins. Plugin Management contains plugin elements in much the same way, except that rather than configuring plugin information for this particular project build, it is intended to configure project builds that inherit from this one.
But you need to configure plug-in in current project, so
<project ...
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.18.1</version>
</dependency>
</dependencies>
</plugin>
...
</plugins>
...
<build>
</project>
Specifying the version for surefire-junit is not required - maven has some rules around it, but I prefer the clarity.
You still need a <scope>test</test> for junit dependency though.