Trying to get the jars available from local directory but getting the following error


(Suraj Kumar Behera) #1

apply plugin: 'java’
apply plugin: ‘eclipse’

sourceCompatibility = '1.7’
version = ‘1.0’

repositories {
maven()
{
url “C:\Users\28891\LocalRepository”
}

}

dependencies
{

compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '2.53.0'
 
testCompile (
                 [group: 'junit', name: 'junit', version: '4.12'],             
          )
        
		testCompile 'org.hamcrest:hamcrest-library:1.3'
        testCompile 'org.hamcrest:hamcrest-core:1.3'
        testCompile 'org.hamcrest:hamcrest-core:1.3-javadoc'
        testCompile 'org.hamcrest:hamcrest-core:1.3-sources'

}

Getting the following error message:
LibraryTest > testSomeLibraryMethod FAILED
java.lang.NoClassDefFoundError at LibraryTest.java:25
Caused by: java.lang.ClassNotFoundException at LibraryTest.java:25

I know some jars are missing can anyone suggest which are all Jars need to copy to the classpath?


(davidmichaelkarr) #2

The backslashes in your url string are being ignored. Replace them with forward slashes (yes, Windows works fine with forward slashes, it’s DOS that requires backslashes).


(Suraj Kumar Behera) #3

No David its not working. getting the same error message.
Thanks for the reply


(davidmichaelkarr) #4

I think we would need to see the entire stack trace, your current build script, and the exact contents of the repository directory you’re specifying.


(Suraj Kumar Behera) #5

BUILD SCRIPT:

apply plugin: 'java’
apply plugin: ‘eclipse’

sourceCompatibility = '1.7’
version = ‘1.0’

repositories
{
maven()
{
url “C:/Users/28891/LocalRepository”
}

}

dependencies
{

compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '2.53.0'
 
testCompile (
                 [group: 'junit', name: 'junit', version: '4.12'],             
          	)
        
		testCompile 'org.hamcrest:hamcrest-library:1.3'
        testCompile 'org.hamcrest:hamcrest-core:1.3'
        testCompile 'org.hamcrest:hamcrest-core:1.3-javadoc'
        testCompile 'org.hamcrest:hamcrest-core:1.3-sources'

}

CONSOLE:

Working Directory: C:\Users\28891\Desktop\Suraj\selenium_sample
Gradle User Home: D:\gradle-2.13-all\gradle-2.13\bin
Gradle Distribution: Local installation at D:\gradle-2.13-all\gradle-2.13
Gradle Version: 2.13
Java Home: C:\Program Files\Java\jdk1.7.0_51
JVM Arguments: None
Program Arguments: None
Gradle Tasks: build

:compileJava
:processResources UP-TO-DATE
:classes
:jar
:assemble
:compileTestJava
:processTestResources UP-TO-DATE
:testClasses
:test

LibraryTest > testSomeLibraryMethod FAILED
java.lang.NoClassDefFoundError at LibraryTest.java:25
Caused by: java.lang.ClassNotFoundException at LibraryTest.java:25

1 test completed, 1 failed
:test FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:test’.

There were failing tests. See the report at: file:///C:/Users/28891/Desktop/Suraj/selenium_sample/build/reports/tests/index.html

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 9.256 secs

FOLDER STRUCTURE:


(Suraj Kumar Behera) #6

Hi, have look on the above uploaded.