src/main/java/HelloWorld.java
public class HelloWorld {
public static void main(String... args) {
System.out.println("HEllo World");
}
}
build.gradle (extrait partiel)
group 'helloworld'
version '1.0-SNAPSHOT'
apply plugin: 'java'
sourceCompatibility = 1.8
(Omis)
jar {
manifest {
attributes 'Main-Class': 'HelloWorld'
}
}
Si vous exécutez la commande gradle suivante, un fichier jar sera créé sous le répertoire de construction du projet.
$ gradle build
Starting a Gradle Daemon (subsequent builds will be faster)
:compileJava
:processResources UP-TO-DATE
:classes
:jar
:assemble
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE
:check UP-TO-DATE
:build
BUILD SUCCESSFUL
Total time: 7.82 secs