saucelabs java tutorial compilation errors - java

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

Related

Cannot find class in classpath: Open_MRS_POM.Open_MRS_Engine

[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.

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.

How to run maven project using batch file?

This is what i have done till now:
I have API automation Script in maven using testng, Following is the structure of project
2.Now i first tried to run testng.xml using command-line with following command.
java -cp ".;C:\Users\A622965\.m2\repository\org\testng\testng\6.8\testng-6.8.jar" org.testng.TestNG testng.xml
3.But throws following error:
Error: Could not find or load main class org.testng.TestNG
Not able to figure out the issue after watching lot of tutorials.
I am looking to batch process the script using Task Schedular in Windows
Remember that Maven is a build tool, so every single operation which requires the classpath must be done through Maven, wether if you want to execute it from the command line or from some GUI.
So, in your case you will find useful the Maven command line tool:
mvn <phases>
In your case:
mvn test
But remember to include first in the pom.xml the testng library dependency, and also to properly configure the surefire plugin.
You need to build path for testng
Right click-->Build -->Libraries Tab-->Add External jar-->Then restart--it will work...

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 to build and Run Storm Topology within Intellij IDEA

I followed Storm Starter instructions and imported Twitter Storm in IntelliJ. For sake of testing I edited ExclaimationToplogy a bit and used following Maven command to build and run it:
mvn -f m2-pom.xml compile exec:java -Dstorm.topology=storm.starter.ExclamationTopology
But I am more interested to build and run within IDE rather than from command line. What actions do I need to perform?
Thanks
Follow the steps in storm-starter's: Using storm-starter with IntelliJ IDEA
Open Maven's pom.xml file and remove <scope>provided</scope> line from storm dependency. This enables IntelliJ to compile storm dependency on build.
Go to /src/jvm/storm/starter/, right click on ExclamationTopology file and Run 'ExclamationTop....main()'
From within IntelliJ, if you get Clojure related compiler errors involving LocalCluster then .... do a mvn clean install -DskipTests from the command line on the same project first. Then do a 'Rebuild Project' from within IntelliJ. Life is full of mysteries :-).
You need to also ensure that the storm-core is not in provided scope for storm-starter.

Categories