aksh-kr / GradleBasics

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Setup of Baisc Gradle project using CLI

gradle init --use-defaults --type java-application

The above command will setup a basic gradle project.

To prepare a jar which is executable, we need to setup a manifest property in build.gradle to identify the Main class to execute.

jar {
    manifest {
        attributes(
                'Main-Class' : 'org.example.Main'
        )
    }
}
./gradlew build

The above command will build the project.

./gradlew jar

The above command creates a new jar file in the build/libs folder.

java -jar build/libs/filename.jar

The above command will execute the code.

About


Languages

Language:Java 100.0%