Cannot find class in classpath: Open_MRS_POM.Open_MRS_Engine - java

[RemoteTestNG] detected TestNG version 6.13.0
Cannot find class in classpath
Tried almost everything mentioned in the previous blogs. Cleaned the project, updated Maven project, restarted Eclipse etc, Edited the TestNG XML file with the package name.class name as mentioned. But still the issue persists.
org.testng.TestNGException:

Try to run the test from Maven command line interface.
1. Go to the project path.
2. Enter the command "mvn clean install".
I have had this several times and this was the solution.
Note: Maven needs to be installed on PC and its environment variables have to be set.

Related

Classes can't be found in Maven Dependencies

I suddenly encountered the following problem: it does not recognise certain class files from the dependencies.
Screenshot
Thinking it was because of my installation, I re-installed everything from Java to the Maven Plugin and tried to compile and run the SimpleExample from a clean project. Which gives the following result: Screenshot and the following exception: Screenshot
Your project is missing the dependency rinsim-core with groupId com.github.rinde.
Check with dependency:list if it is present. If not, add it.
If it is already there, try to compile the project outside eclipse. Install a command line maven, navigate to the directory, do mvn clean package and report any error you get as a comment under this answer.

maven install shows error but when i execute maven -X install build success

I have a java maven application when i execute the command mvn install it shows compilation error stating that the particular user defined package is not found. When i execute build maven from eclipse by passing -X clean install in goals it passes.
I am passing an User-defined Java object to the method as parameters(I am using the same process for different method with the same object it worked) but wen i create a new method it fails.
maven 3.5 version
any help would be appreciated
i found the issue was with the pom.xml where they build two different goals one to compile the main files and the other is to compile class files. I wrongly added the test beans to main project rather than it must be in test side. So, at the time of compilation first it compiles the main files these test beans binaries would not be available in the heap so it fails.
now the issue has been resolved. Thanks for the help #DarsanMetha and #khmarbaise

How do I get IntelliJ to recognise resource bundle when compiling?

Ok, first up I am almost completely unfamiliar with Java and Java tooling.
I am attempting to contribute a bugfix to a Jenkins plugin. Code-wise the fix is simple, my problem is in trying to compile the project and run the tests locally.
I have installed IntelliJ IDEA 15CE and started a new project, pointing it to my local clone of the plugin repo.
It has gone away and 'downloaded the internet' in terms of Maven dependencies. Mostly everything looks ok. What I want to do is to run the tests...
If I right-click at the root of the project and select 'Run All Tests' I get the error:
Error:(115, 29) java: cannot find symbol
symbol: variable Messages
location: class hudson.plugins.copyartifact.BuildSelector
The source of this error is a line:
console.println(Messages.CopyArtifact_MissingSrcArtifacts(srcDir));
https://github.com/jenkinsci/copyartifact-plugin/blob/master/src/main/java/hudson/plugins/copyartifact/BuildSelector.java#L115
As far as I can tell the Messages symbol should resolve to this properties file:
https://github.com/jenkinsci/copyartifact-plugin/blob/master/src/main/resources/hudson/plugins/copyartifact/Messages.properties
...which IDEA recognises as a 'Resource Bundle' in the project tree view.
But it doesn't seem to recognise it when compiling the project.
I have no idea where to start fixing this. The tests run fine if I push a commit to a pull request on GitHub and let the cloudbees.com Jenkins server run them, but I'd like to be able to test stuff locally first.
Run the maven compile command from Intelli-J Maven tool. After compiling error will vanish.
When you compile it will generate a Messages.java file in generated sources automatically.

saucelabs java tutorial compilation errors

I'm experiencing various compile/run errors when I try the Sauce Labs Java tutorial. These errors are different when I run Maven in the command line and in Eclipse (Juno)
The java tutorial for Sauce Labs shows the Maven command to generate a JUnit based project
mvn archetype:generate -DarchetypeRepository=http://repository-saucelabs.forge.cloudbees.com/release -DarchetypeGroupId=com.saucelabs -DarchetypeArtifactId=quickstart-webdriver-junit -DarchetypeVersion=1.0.17 -DsauceUserName=username -DsauceAccessKey=access_key
The folder structure, maven pom file, and the code is generated by this command and the tutorial instructs the user to change to the newly created project folder and run the following command
mvn test
At this point I am getting a java.lang.ClassNotFoundException error. The org.junit.runner.notification.RunListener is apparently not found, even though I can see it in the Maven dependencies for the project (in Eclipse)
I am also getting an error saying that Maven cannot find the following library sauce_junit1.0.17.jar
I have found a fix to issue running mvn test from the command line. Change the DarchetypeVersion from 1.0.17 to 1.0.18 when generating the project
mvn archetype:generate -DarchetypeRepository=http://repository-saucelabs.forge.cloudbees.com/release -DarchetypeGroupId=com.saucelabs -DarchetypeArtifactId=quickstart-webdriver-junit -DarchetypeVersion=1.0.18 -DsauceUserName=username -DsauceAccessKey=access_key
I can see that the sauce_junit jar file is in my local repo for 1.0.18 but not 1.0.17

springframework source in Idea Intellij

I'm having hard time to setup springframework code in Intellij.
I git-cloned springframework project from github, and ran ant task to get all the libraries into ivy-cache directory.
I found "spring-framework.ipr" file for intellij project, and opened it.
Unfortunately, some of the libraries are not correctly mapped to the jar files or missing. So I cannot compile the codebase in IDE.
I also tried importing as eclipse project into intellij. Jar file reference seems ok.
But there are compilation errors in OXM module. Some test classes have reference to auto generated classes such as "~.samples.flight.FlightDocument", "~.jaxb.test.FlightType", and they don't exist(ant test goal generates them in target dir).
It seems same problem happens in STS.
I referenced this blog post:
http://blog.springsource.org/2009/03/03/building-spring-3/
Any good idea to setup spring code in intellij?
I use intellij v11.
git branch: 3.1.x
git commit: e8fc90ce3e4554f14eaa86ce05591249d3fe62fa
Compilation error example:
.../org.springframework.oxm/src/test/java/org/springframework/oxm/xmlbeans/XmlBeansMarshaller Tests.java
Error:(29,42) package org.springframework.samples.flight does not exist
Error:(30,42) package org.springframework.samples.flight does not exist
Error:(44,9) cannot find symbol class FlightsDocument
Error:(44,58) package FlightsDocument does not exist
....
Thanks,
problem solved.
"spring-framework.ipr" is the one for intellij.
lesson learned:
simply wrong version of junit was referenced in spring-framework.ipr file.
when ant build failed middle of the test, subsequent module won't be built. so, required libraries won't be downloaded into ivy-cache/repository.
"ant jar" goal will not download test related libraries since the goal doesn't run tests
After all the tests passed and manually fixed junit reference, intellij finally has no errors.

Categories