Java file compilation


(vivek prasad) #1

Can anyone please provide me with an example of how to compile a java file along with dependencies using maven repository. I dont want to use any maven pom script . If possible please provide the working script example in gradle only


(René Groeschke) #2

hey vivek,

the gradle userguide contains a “java quickstart” chapter that should help you to get started fast. You can find another example of a simple java build in the full gradle distribution in the samples/java/quickstart subfolder

cheers, René


(vivek prasad) #3

I have already consulted with the userguide however it did not helped me much . As i am new to gradle i just need an example to compile a simple java file .


(vivek prasad) #4

Thank You for fast response


(spencer_allain) #5

Maybe not quite what your are looking for, but the most simplistic java build is listed out on the Wikipedia entry for Gradle:

http://en.wikipedia.org/wiki/Gradle

In some directory, create a build.gradle file with just apply plugin: ‘java’, and then create the subdirectory src/main/java and place one or more java files into the corresponding package-scoped subdirectories.

From the directory with the build.gradle, run the command gradle build, and it should compile and package up a jar into the build/libs directory.

-Spencer