gradle

Open source build automation system

Install on Slackware

   1 cd /usr/local
   2 wget https://services.gradle.org/distributions/gradle-3.2.1-bin.zip
   3 unzip -t gradle-3.2.1-bin.zip
   4 unzip gradle-3.2.1-bin.zip
   5 cd /usr/local/gradle-3.2.1/bin
   6 ./gradle 
   7 cd ..
   8 ln -s gradle-3.2.1 gradle
   9 nano /etc/profile # add to PATH the /usr/local/gradle/bin
  10 . /etc/profile

Example console app

   1 export JAVA_HOME=/home/vitor/jdk1.8.0_251/
   2 cd /tmp
   3 mkdir hello
   4 cd hello
   5 gradle init
   6 mkdir -p ./src/main/java/org/allowed/bitarus
   7 nano ./src/main/java/org/allowed/bitarus/Hello.java
   8 nano build.gradle 
   9 ./gradlew --version 
  10 # Gradle 4.4.1
  11 ./gradlew build
  12 java -jar build/libs/hello-0.1.0.jar 

build.gradle

   1 apply plugin: 'application'
   2 mainClassName = "org.allowed.bitarus/Hello"
   3 
   4 apply plugin: 'java'
   5 
   6 repositories {
   7     mavenCentral()
   8 }
   9 
  10 dependencies {
  11 }
  12 
  13 jar {
  14     baseName = "hello"
  15     version = "0.1.0"
  16     manifest {
  17         attributes 'Implementation-Title': baseName,
  18                    'Implementation-Version': version,
  19                    'Main-Class': mainClassName
  20     }
  21 }

src/main/java/org/allowed/bitarus/Hello.java

   1 package org.allowed.bitarus;
   2 
   3 public class Hello{
   4   public static void main(String[] args){
   5     System.out.println("Hello ");
   6   }
   7 }

gradle (last edited 2023-05-26 14:36:15 by 127)