Maven TestNG Class No found exception - maven

I'm running TestNG file from maven and I'm getting this exception.
I checked target folder of maven there are no classes generated
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test
(default-test) on project Tes ts: Execution default-test of goal
org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test failed:
There was an error in the forked process
[ERROR] org.testng.TestNGException: [ERROR] Cannot find class in
classpath: ai.dharma.web.test.functional.TestBaseSetup [ERROR] at
org.testng.xml.XmlClass.loadClass(XmlClass.java:81) [ERROR] at
org.testng.xml.XmlClass.init(XmlClass.java:73)

Ok i found answer almost after 5 days of deep search..
it was folder structure,it should be "Src > Main > Java" + your regular package structure, maven searches through that structure for generating class..

Related

json-patch-1.13.jar: CVE-2021-4279(9.8) Quarkus 2.15.2.Final

The dependency check is now failing on json-patch:
[ERROR] Failed to execute goal org.owasp:dependency-check-maven:7.4.3:check (default-cli) on project ins-app: [ERROR] [ERROR] One or more dependencies were identified with vulnerabilities that have a CVSS score greater than or equal to '8.0': [ERROR] [ERROR] json-patch-1.13.jar: CVE-2021-4279(9.8) CVE is https://nvd.nist.gov/vuln/detail/CVE-2021-4279
The fix PR is probably here (Starcounter-Jack/JSON-Patch#7ad6af4). But it is another repository?
https://github.com/java-json-tools/json-patch/issues/144
It is actually a bug on DependencyCheck, one that was already addressed:
https://github.com/jeremylong/DependencyCheck/issues/5212
You could add it to your suppression list.

Build works if XML is run in intellij, but command line run gets error

if i run test.xml in intellj - everything is ok, test is successfully runned.
but if i try run test in command line with this code "mvn clean compile"
i get errors like this:
[ERROR] symbol: class IInvokedMethod
[ERROR] location: class core.Web.RetryMethods.RetryListenerClass
[ERROR] /C:/Users/Vartotojas/Desktop/Automatiniai testia/automation/src/main/core/Web/RetryMethods/RetryListenerClass.java:[63,68] cannot find symbol
[ERROR] symbol: class ITestResult
[ERROR] location: class core.Web.RetryMethods.RetryListenerClass
[ERROR] /C:/Users/Vartotojas/Desktop/Automatiniai testia/automation/src/main/core/TestRail/api/DataForAPI.java:[5,1] package org.testng does not exist
[ERROR] /C:/Users/Vartotojas/Desktop/Automatiniai testia/automation/src/main/core/TestRail/api/DataForAPI.java:[77,96] cannot find symbol
[ERROR] symbol: class ITestResult
[ERROR] location: class core.TestRail.api.DataForAPI
[ERROR] /C:/Users/Vartotojas/Desktop/Automatiniai testia/automation/src/main/core/TestRail/TestRailMethods/TestCases.java:[7,1] package org.testng does not exist
[ERROR] /C:/Users/Vartotojas/Desktop/Automatiniai testia/automation/src/main/core/TestRail/TestRailMethods/TestCases.java:[8,1] package org.testng.internal does not exist
[ERROR] /C:/Users/Vartotojas/Desktop/Automatiniai testia/automation/src/main/core/TestRail/TestRailMethods/TestCases.java:[58,46] cannot find symbol
[ERROR] symbol: class ISuite
what can i do here?
i have tryied to update testng jar, but that doesn't helped.
P.S.
Errors after scope tag is deleted:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.436 s
[INFO] Finished at: 2021-03-30T09:38:25+03:00
[INFO] Final Memory: 30M/279M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test (default-test) on project automation: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\Vartotojas\Desktop\Automatiniai testia\automation\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
[ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_212\jre\bin\java" -javaagent:C:\Users\Vartotojas\.m2\repository/org/aspectj/aspectjweaver/1.9.2/aspectjweaver-1.9.2.jar -jar C:\Users\VARTOT~1\
AppData\Local\Temp\surefire2399529717162338559\surefirebooter2518614099656505245.jar C:\Users\Vartotojas\AppData\Local\Temp\surefire2399529717162338559 2021-03-30T09-38-22_595-jvmRun1 surefire440322083299018669
4tmp surefire_04103581849292117664tmp"
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 1
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_212\jre\bin\java" -javaagent:C:\Users\Vartotojas\.m2\repository/org/aspectj/aspectjweaver/1.9.2/aspectjweaver-1.9.2.jar -jar C:\Users\VARTOT~1\
AppData\Local\Temp\surefire2399529717162338559\surefirebooter2518614099656505245.jar C:\Users\Vartotojas\AppData\Local\Temp\surefire2399529717162338559 2021-03-30T09-38-22_595-jvmRun1 surefire440322083299018669
4tmp surefire_04103581849292117664tmp"
It looks like you have added a <scope>test</scope> when you added a TestNG dependency in your pom file.
This causes TestNG related classes to be visible in the class path only for your tests (i.e., all your Java code that resides in src/test/java)
If you remove this, then the TestNG related classes will be visible in the class path for both src/main/java and src/test/java)

Can't build maven Vaadin 11 starter pack, missing dependency?

I can't build the maven Vaadin 11 starter pack like mentioned in the tutorial section of the doc. It seems that a package is missing, which provide an #Helper annotation. I tried to add the dependency in the pom.xml but no luck.
Here's the log from Maven :
-------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.653 s
[INFO] Finished at: 2018-09-15T11:30:01+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project my-starter-project: Compilation failure: Compilation failure:
[ERROR] /Users/olivierbatard/Java/Vaadin/my-starter-project/src/main/java/org/hammicus/vaadin/Customer.java:[5,44] package com.vaadin.flow.tutorial.annotations does not exist
[ERROR] /Users/olivierbatard/Java/Vaadin/my-starter-project/src/main/java/org/hammicus/vaadin/Customer.java:[12,2] cannot find symbol
[ERROR] symbol: class Helper
[ERROR] /Users/olivierbatard/Java/Vaadin/my-starter-project/src/main/java/org/hammicus/vaadin/CustomerStatus.java:[3,44] package com.vaadin.flow.tutorial.annotations does not exist
[ERROR] /Users/olivierbatard/Java/Vaadin/my-starter-project/src/main/java/org/hammicus/vaadin/CustomerStatus.java:[5,2] cannot find symbol
[ERROR] symbol: class Helper
[ERROR] /Users/olivierbatard/Java/Vaadin/my-starter-project/src/main/java/org/hammicus/vaadin/CustomerService.java:[12,44] package com.vaadin.flow.tutorial.annotations does not exist
[ERROR] /Users/olivierbatard/Java/Vaadin/my-starter-project/src/main/java/org/hammicus/vaadin/CustomerService.java:[21,2] cannot find symbol
[ERROR] symbol: class Helper
[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
When I add the dependency in the pom :
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.982 s
[INFO] Finished at: 2018-09-15T11:38:43+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project my-starter-project: Could not resolve dependencies for project org.hammicus.vaadin:my-starter-project:war:1.0-SNAPSHOT: Could not find artifact com.vaadin:flow-documentation-parent:jar:1.1-SNAPSHOT in Vaadin Directory (http://maven.vaadin.com/vaadin-addons) -> [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/DependencyResolutionException
Here is the pom.xml section with the dependency I added :
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>flow-documentation-parent</artifactId>
<version>1.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
Here is the link to the tutorial : https://vaadin.com/docs/v11/flow/introduction/tutorial-get-started.html
Does anyone know how to fix the dependency ?
You can remove all references to the #Helper annotation from the code. It's only used by our own internal tests that verify the tutorial code compiles.
I've created a ticket about fixing the tutorial and/or the code so that this shouldn't be an issue in the future.

Maven compilation failure error

When i compile my bdd frame work in java getting the following compilation error.I am new to this.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.
2:compile (default-compile) on project workflows.automation: Compilation
failure: Compilation failure:
[ERROR] /C:/OFFICIAL/BDDFramework/workflows.automation/src/main/java/bdd
/automation/pages/LoginPage.java:[23,1] package org.jbehave.core
.annotations does not exist
[ERROR] /C:/OFFICIAL/BDDFramework/workflows.automation/src/main/java/bdd
/automation/pages/LoginPage.java:[31,11] cannot find symbol
[ERROR] symbol: class BeforeStory
[ERROR] location: class bdd.automation.pages.LoginPage
[ERROR] -> [Help 1]
The error says that jbehave core is missing at compilation time. Add jbehave-core into your pom.xml as a new maven dependency.
See https://mvnrepository.com/artifact/org.jbehave/jbehave-core

Maven surefire - test failures on clean install

I have a Spring MVC project that I am currently working on. Everything looks fine and I am not missing any of the jar files. On "mvn clean install" I am getting the error below.
So far I've tried all the other suggestion that I found on similar topics like: "mvn dependency::tree" so I can check if I am missing any repository but no result.
For some guys it looks like "mvn clean install -U" was the solution but not in my case, getting the same error.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:17 min
[INFO] Finished at: 2014-12-09T11:46:34+00:00
[INFO] Final Memory: 23M/226M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.
12.4:test (default-test) on project am: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\ADMIN\Documents\Code Base\Removable Disk\am
\target\surefire-reports for the individual test results.
[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/MojoFailureExc
eption
C:\Users\ADMIN\Documents\Code Base\Removable Disk\am>
One or more test(s) are failing. You have two options
Fix those test cases and try.
or
Run mvn clean install -Dmaven.test.skip. This command will skips the test phase.

Resources