Build java project with gradle

hey all,

I want to compile a java project with gradle, i tried with the script but the problem is that i have jars that are defined in the file .classpath and in the lib repertory but it’s not reading the jars.

apply plugin: 'java'
apply plugin:'application'
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceSets {
   main {
      java {
         srcDir 'src'
      }
   }
}
repositories {
    mavenCentral()
}
dependencies {
   compile 'org.slf4j:slf4j-api:1.7.12'
   testCompile 'junit:junit:4.12'
}

Then I executed the script with this command : gradle build

The project structure:

file .classpath :

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="src" path="src"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
	<classpathentry kind="lib" path="/app/ATG/ATG11.2/DCS/lib/resources.jar"/>
	<classpathentry kind="lib" path="/app/ATG/ATG11.2/DCS/lib/classes.jar"/>
        ........
	<classpathentry kind="output" path="classes"/>
</classpath>

Regards.

Gradle does not consider the eclipse ‘…classparh’ file. to get the dependencies added to your gradle build you can either reference the files in the lib folder explicitly by

’’’
dependencies {
compile filetree(‘lib’)
}
‘‘‘

Alternatively you can declare a file based repository pointing to “lib” and reference each dependency in the dependencies block as you tried it in your sample. Learn more about file repositories at the according chapter in the gradle userguide at https://docs.gradle.org/current/userguide/dependency_management.html#sec:flat_dir_resolver

Once you have solved this you can apply the eclipse plugin and generate the eclipse ’.project’ and ’.classpath’ files from gradle

cheers,
rene