Jenkins Non-readable POM - java

This error is posted in different forums even here. I have tried the different alternatives. I tried changing the POM permissions. I am using the default maven settings. JDK is 8, Maven 3.5.3.
I just want to try a very simple junit application. From the command line I have no problems running "mvn test"
junitexample amh$ mvn test
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.junit:junit-example >-----------------------
[INFO] Building junit-example 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # junit-example ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # junit-example ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # junit-example ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/amhg/Documents/dev/intellik2/junitexample/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # junit-example ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # junit-example ---
[INFO] Surefire report directory: /Users/amhg/Documents/dev/intellik2/junitexample/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running CalculatorTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.045 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.178 s
[INFO] Finished at: 2018-04-08T01:39:52+02:00
[INFO] ------------------------------------------------------------------------
But from Jenkins, from the Console Output I have this error:
Console Output
Started by user Andrea
Building in workspace /Users/Shared/Jenkins/Home/workspace/calc
[calc] $ /Users/amhg/apache-maven-3.5.3/bin/mvn -f /Users/amhg/Documents/dev/intellik2/junitexample test
POM file /Users/amhg/Documents/dev/intellik2/junitexample specified with the -f/--file command line argument does not exist
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-readable POM /Users/amhg/Documents/dev/intellik2/junitexample: /Users/amhg/Documents/dev/intellik2/junitexample (Permission denied) #
#
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project (/Users/amhg/Documents/dev/intellik2/junitexample) has 1 error
[ERROR] Non-readable POM /Users/amhg/Documents/dev/intellik2/junitexample: /Users/amhg/Documents/dev/intellik2/junitexample (Permission denied)
[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/ProjectBuildingException
Build step 'Invoke top-level Maven targets' marked build as failure
Finished: FAILURE
This is my POM file
<?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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.junit</groupId>
<artifactId>junit-example</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>junit-example</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>
And I just have a simple test:
import org.junit.BeforeClass;
import org.junit.Test;
import static junit.framework.TestCase.assertEquals;
public class CalculatorTest {
private static ICalculator calculator;
#BeforeClass
public static void initCalculator() {
calculator = new Calculator();
}
#Test
public void testSum() {
int result = calculator.sum(3, 4);
assertEquals(7, result);
}
}
I don´t know what else I could try. I opened all the topics related to the problem.
Any other suggestion?

I had exact same problem - local maven build works and Jenkins fails with the same error as yours.
Once Jenkins job is started, it will import source code to /your-jenkins/workspace/your-job-name folder and then start building. In your DSL, you have to mention the path to your pom in the workspace.
Take a look at the Jenkins workspace view to see where your pom is located once the source code is downloaded. This will aid in resolving the problem.

in the -f option you have provided. the maven is unable to identify the pom to read
-f /Users/amhg/Documents/dev/intellik2/junitexample test
try giving in the complete name of the pom including .xml
-f /Users/amhg/Documents/dev/intellik2/junitexample nameofpom.xml

Please check what you have in your Jenkins Build -> Goals and in your Build -> POM.
You probably switched those two.

Related

Maven build fails with "package com.fasterxml.jackson does not exist"

I need to parse a json file in my maven project.
For that I started with a simple import in my java file (App.java)
package com.mycompany.app;
import com.fasterxml.jackson.*;// <-------- HERE
public class App
{
public static void main( String[] args )
{
}
}
Then, I tried to compile the project by using mvn package but I got an error:
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.mycompany.app:my-app >----------------------
[INFO] Building my-app 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) # my-app ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /tmp/my-app/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) # my-app ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /tmp/my-app/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /tmp/my-app/src/main/java/com/mycompany/app/App.java:[2,1] package com.fasterxml.jackson does not exist
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.628 s
[INFO] Finished at: 2022-05-10T15:31:39+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project my-app: Compilation failure
[ERROR] /tmp/my-app/src/main/java/com/mycompany/app/App.java:[2,1] package com.fasterxml.jackson does not exist
[ERROR]
[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/MojoFailureException
Here is how I built my maven project:
I created my maven project:
mvn -B archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4
I modified the file App.java (created by the previous command) to match with my file.
I modified pom.xml in order to add the dependency:
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.13.2</version>
</dependency>
Do you know how to solve this error?
I've already recently answered a similar question: the problem is that com.fasterxml.jackson is not a package, there is a folder com/fasterxml/jackson (see the source), but not a package. In Java, package is a namespace that contains at least one class. Asterix import imports non-recursively all the classes in the package. So, if you need, let's say, to use classes JsonParser.java and JacksonException.java from the package com.fasterxml.jackson.core, you may add an asterix import like that: com.fasterxml.jackson.core.*

Maven Surefire not running JUnit 5 tests

I've been trying to run JUnit 5 tests with Maven Surefire. However, it doesn't seem like Surefire is running any tests at all, even though I do have some, and in the default directory, too.
This is the console output I'm getting: https://prnt.sc/ugo1xt
Here are the relevant parts of the pom.xml:
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.7.0-M1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
</plugin>
</plugins>
</build>
The surefire version is 3.0.0-M4.
I've tried pretty much any fix I could find on Google, although most of them seemed to be outdated. Any help would be greatly appreciated.
Cheers!
EDIT: Here's an example of my tests:
package bankprojekt;
import bankprojekt.verarbeitung.*;
import org.junit.jupiter.api.*;
import static org.junit.jupiter.api.Assertions.*;
public class GirokontoTest {
Girokonto gk;
#BeforeEach
void setup(){
gk = new Girokonto();
gk.einzahlen(500);
}
#AfterEach
void teardown(){
gk = null;
}
#Test
void abhebenMitWaehrungswechsel(){
try{
gk.abheben(195.583, Waehrung.BGN);
}
catch (Exception e) {
System.out.println(e);
}
assertEquals(400, gk.getKontostand());
}
#Test
void einzahlenMitWaehrungswechsel(){
gk.einzahlen(195.583, Waehrung.BGN);
assertEquals(600, gk.getKontostand());
}
}
There are two things. First you should upgrade jacoco dependency to 0.8.5 otherwise it fails based on the JDK14 requirement. (Created an pull request to your repository). If those things are configured appropriately the result is this:
I would also recommend to upgrade maven-compiler-plugin to most recent version and also all other plugins.
As you can see you have WARNING's in your build which should be fixed and failing tests.
This build has been run on plain command line also with JUnit-Jupiter 5.7.0 which works perfectly.
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # prog3-sose2020 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 9 source files to /Users/khmarbaise/ws-git-so/prog3-sose2020/target/classes
[WARNING] /Users/khmarbaise/ws-git-so/prog3-sose2020/src/main/java/bankprojekt/verarbeitung/Kunde.java: /Users/khmarbaise/ws-git-so/prog3-sose2020/src/main/java/bankprojekt/verarbeitung/Kunde.java uses or overrides a deprecated API.
[WARNING] /Users/khmarbaise/ws-git-so/prog3-sose2020/src/main/java/bankprojekt/verarbeitung/Kunde.java: Recompile with -Xlint:deprecation for details.
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # prog3-sose2020 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/khmarbaise/ws-git-so/prog3-sose2020/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # prog3-sose2020 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /Users/khmarbaise/ws-git-so/prog3-sose2020/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M4:test (default-test) # prog3-sose2020 ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running bankprojekt.GirokontoTest
[ERROR] Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.087 s <<< FAILURE! - in bankprojekt.GirokontoTest
[ERROR] bankprojekt.GirokontoTest.abhebenMitWaehrungswechsel Time elapsed: 0.052 s <<< FAILURE!
org.opentest4j.AssertionFailedError: expected: <448.87081188037814> but was: <400.0>
at bankprojekt.GirokontoTest.abhebenMitWaehrungswechsel(GirokontoTest.java:31)
[INFO] Running bankprojekt.WaehrungTest
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.005 s - in bankprojekt.WaehrungTest
Kunde Mustermann, Max zerst�rt
[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR] GirokontoTest.abhebenMitWaehrungswechsel:31 expected: <448.87081188037814> but was: <400.0>
[INFO]
[ERROR] Tests run: 5, Failures: 1, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.792 s
[INFO] Finished at: 2020-09-14T17:50:43+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test (default-test) on project prog3-sose2020: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/khmarbaise/ws-git-so/prog3-sose2020/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[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.

Code builds fine from eclipse but throwing compile time errors from Jenkins

I am new to Jenkins , i have selenium code which i am building using maven. I have mentioned the maven's testng.xml file in pom.xml when i run pom.xml file as maven -> build from Eclipes, the code build fine and project's jar file even generated . I have integrated the same code in to Jenkins job. When i run the job I have observed that Jenkins is not downloading the jars from pom.xml [cause i am not seeing any jar download logs in Jenkin job console] and its throwing error saying package not found
ajnakir#WKWIN9326287 MINGW64 /c/D/QURATE/LoggingAndAssertExample (master)
$ mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] --------------< com.sapient.mercury:PageFactoryFrameWork >--------
------
[INFO] Building PageFactoryFrameWork 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) #
PageFactoryFrameWork ---
[INFO] Deleting C:\D\QURATE\LoggingAndAssertExample\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) #
PageFactoryFrameWork ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered
resources, i.e. build is platform dependent!
[INFO] Copying 5 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) #
PageFactoryFrameWork ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252,
i.e. build is platform dependent!
[INFO] Compiling 4 source files to
C:\D\QURATE\LoggingAndAssertExample\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/D/QURATE/LoggingAndAssertExample/src/main/java/
com/banking/resources/BasePage.java:[17,26] package org.testng.asserts
does not exist
[ERROR]
/C:/D/QURATE/LoggingAndAssertExample/src/main/java/
com/banking/resources/BasePage.java:[23,23] cannot find symbol
symbol: class SoftAssert
location: class com.banking.resources.BasePage
[ERROR] /C:/D/QURATE/LoggingAndAssertExample/src/main/
java/com/banking/resources/Browser.java:[16,26] package
org.testng.asserts does not exist
[ERROR]
/C:/D/QURATE/LoggingAndAssertExample/src/main/java/
com/banking/resources/Browser.java:[23,23] cannot find symbol
symbol: class SoftAssert
location: class com.banking.resources.Browser
[ERROR]
/C:/D/QURATE/LoggingAndAssertExample/src/main/java/
com/banking/resources/Browser.java:[23,51] cannot find symbol
symbol: class SoftAssert
location: class com.banking.resources.Browser
[INFO] 5 errors
[INFO] -------------------------------------------------------------
[INFO] -----------------------------------------------------------------
-------
[INFO] BUILD FAILURE
[INFO] -----------------------------------------------------------------
-------
[INFO] Total time: 2.542 s
[INFO] Finished at: 2019-08-14T19:15:25+05:30
[INFO] -----------------------------------------------------------------
-------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-
plugin:3.8.1:compile (default-compile) on project PageFactoryFrameWork:
Compilation failure: Compilation failure:
[ERROR]
/C:/D/QURATE/LoggingAndAssertExample/src/main/java/
com/banking/resources/BasePage.java:[17,26] package org.testng.asserts
does not exist
Please help me how should i proceed
I have cross checked and made sure that all necessary plugins and mappings like Git hub repo url is available. I am even able to run another project which have the source from my local
Make sure to explicitly add TestNG dependency to your pom.xml file like:
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
<scope>test</scope>
</dependency>
In general as per Page Object Model Design Pattern best practices you should not have any assertions in the Page Object classes, their goal is to provide an abstraction layer between UI and test logic so you should have only WebElements definitions and helper functions there, but Assertions should be placed in the test code only, not in the Page Objects
FIX: We are not supposed to mention scope tag for dependency in pom.xml, I have removed the test from testng dependency in pom.xml, my maven build successfully completed.

mvn install:install-file is unable to install ojdbc7.jar at correct location

I am having difficulty in getting this ojdbc7 JAR file installed in the correct location. I tried the following from Windows 10 command prompt and got the BUILD SUCCESS message as shown below:
C:\Users\john>mvn install:install-file -Dfile=C:\ojdbc7.jar -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0.1 -Dpackaging=jar
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) # standalone-pom ---
[INFO] Installing C:\ojdbc7.jar to C:\Users\l-john\.m2\repository\com\oracle\ojdbc7\12.1.0.1\ojdbc7-12.1.0.1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.381 s
[INFO] Finished at: 2018-10-24T12:09:04-05:00
[INFO] ------------------------------------------------------------------------
However, when I went inside the 12.1.0.1 folder (located here C:\Users\john\.m2\repository\com\oracle\ojdbc7\12.1.0.1) I only saw the following files :
For one of my Maven project, eclipse(version 2018-19) is trying to access the JAR file and I keep getting following BUILD FAILURE message which is obvious since the file isn't there:
BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.208 s
[INFO] Finished at: 2018-10-24T12:15:39-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project MyProject: Could not resolve dependencies for project com.company.ii:MyProject:war:0.1: Could not find artifact com.oracle.jdbc:ojdbc7:jar:12.1.0.1 in spring-releases (https://repo.spring.io/libs-release) -> [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.
In my pom.xml, I do have the dependency defined as follows:
Is there anything I am doing wrong? Please let me know if I need to perform some additional testing?
I could see that in mvn install command -DgroupId is not correct, instead of giving "-DgroupId=com.oracle.jdbc", you have given just "-DgroupId=com.oracle"
Maven tells you it is installing the jar to
C:\Users\l-john\.m2\repository\com\oracle\ojdbc7\12.1.0.1\ojdbc7-12.1.0.1.jar
But you are looking at
C:\Users\john\.m2\repository\com\oracle\ojdbc7\12.1.0.1
l-john vs john

Missing JUNIT Jar Exception while building project using Maven

I am in the beginning phase of Maven. I created a project and was trying to use the command. what is missing at my end? I am trying to compile and run a TestSuite File:
mvn clean package
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.test.myProject</groupId>
<artifactId>myTest</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>egdsvTest</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
but i get the below exception after using it.
Exception
D:\MVN_Shirish_Project\Test>mvn clean package
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethrea
ded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Test 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # Test ---
[INFO] Deleting D:\MVN_Shirish_Project\Test\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # Test
---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\MVN_Shirish_Project\Test\src\
main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) # Test ---
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. b
uild is platform dependent!
[INFO] Compiling 1 source file to D:\MVN_Shirish_Project\Test\target\classe
s
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # eg
dsvTest ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\MVN_Shirish_Project\Test\src\
test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) #
Test ---
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. b
uild is platform dependent!
[INFO] Compiling 1 source file to D:\MVN_Shirish_Project\Test\target\test-c
lasses
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # Test ---
[INFO] Surefire report directory: D:\MVN_Shirish_Project\Test\target\surefi
re-reports
[WARNING] Missing POM for org.apache.maven.surefire:surefire-junit3:jar:2.12.4
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.968 s
[INFO] Finished at: 2014-10-14T12:28:09+05:30
[INFO] Final Memory: 7M/247M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.
12.4:test (default-test) on project Test: Unable to generate classpath: org
.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException: Missing:
[ERROR] ----------
[ERROR] 1) org.apache.maven.surefire:surefire-junit3:jar:2.12.4
[ERROR]
[ERROR] Try downloading the file manually from the project website.
[ERROR]
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=org.apache.maven.surefire -DartifactI
d=surefire-junit3 -Dversion=2.12.4 -Dpackaging=jar -Dfile=/path/to/file
[ERROR]
[ERROR] Alternatively, if you host your own repository you can deploy the file t
here:
[ERROR] mvn deploy:deploy-file -DgroupId=org.apache.maven.surefire -DartifactId=
surefire-junit3 -Dversion=2.12.4 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url
] -DrepositoryId=[id]
[ERROR]
[ERROR] Path to dependency:
[ERROR] 1) dummy:dummy:jar:1.0
[ERROR] 2) org.apache.maven.surefire:surefire-junit3:jar:2.12.4
[ERROR]
[ERROR] ----------
[ERROR] 1 required artifact is missing.
[ERROR]
[ERROR] for artifact:
[ERROR] dummy:dummy:jar:1.0
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR] m1 (http://repo1.maven.org/maven2, releases=true, snapshots=false)
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception
Maven works by creating a local repository in your desktop or the machine you have installed maven and running this goal.
In the process of maven running the goal, it first tries to get all the dependent jar files from Central repository as you have listed in your comments M1 or M2 and then stores them under C:/Users/yourname/.m2/repository folder (assuming you are using a windows machine) or the corresponding user folder in other OS systems.
Then it uses the jars to run the build as required per the goals given.
Now in your case, you got to figure out a way to connect to the repositories (check your settings.xml located in the .m2 folder in your User directory) and check if you can connect to the internet central maven repositories. If not you can get the jar file and manually install them as advised in the error you have got. Once you do that I think you should get past this issue. Let me know if you still have the issues.
In my case, it was caused by me doing an offline build (i.e. mvn -o install) and me not having that jar installed in my local Maven repository yet. Doing an online build (mvn install) fixed it.

Categories