Skip to content

jperezdelafuente/boot-cantaloupe

 
 

Repository files navigation

boot-cantaloupe project

boot cantaloupemaster

Note
testing and tasting the Boot fruit

1. JDK & friends download and installation

  1. Java SE Development Kit 8

    wget --no-check-certificate --no-cookies \
      --header "Cookie: oraclelicense=accept-securebackup-cookie" \
      --progress=dot:giga \
      http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz
    sudo tar xvf jdk-8u131-linux-x64.tar.gz -C /usr/local/share/
    sudo ln -sf /usr/local/share/jdk1.8.0_131/bin/java /usr/local/bin/java
    java -version
  2. Gradle 3.5

    wget --progress=dot:giga \
      https://services.gradle.org/distributions/gradle-3.5-all.zip
    sudo unzip gradle-3.5-all.zip -d /usr/local/share/
    sudo ln -sf /usr/local/share/gradle-3.5/bin/gradle /usr/local/bin/gradle
    gradle -version
    gradle wrapper --gradle-version 3.5
  3. Maven 3.5.0

    wget --progress=dot:giga \
      http://www-us.apache.org/dist/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz
    sudo tar xvf apache-maven-3.5.0-bin.tar.gz -C /usr/local/share/
    sudo ln -sf /usr/local/share/apache-maven-3.5.0/bin/mvn /usr/local/bin/mvn
    mvn -v
  4. Ascii Art Generator

    http://patorjk.com/software/taag/

2. Proyecto básico

  1. Crear una carpeta con el nombre del proyecto y acceder.

  2. Crear el fichero build.gradle con las configuraciones necesarias

  3. Crear los directorios del proyecto.

  4. Crear la clase principal App.java.

Terminal.app
$ mkdir myproject && cd myproject (1)

$ touch build.gradle (2)

$ mkdir -p src/{main,test}/{java,resources} src/main/java/com/myproject (3)

$ touch src/main/java/com/myproject/App.java (4)
build.gradle
plugins {
    id 'org.springframework.boot' version '1.5.3.RELEASE'
    id 'java'
}

jar {
    baseName = 'myproject'
    version =  '0.0.1-SNAPSHOT'
}

repositories {
    jcenter()
}

dependencies {
    compile("org.springframework.boot:spring-boot-starter")
    testCompile("org.springframework.boot:spring-boot-starter-test")
}
App.java
package com.myproject;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class App implements CommandLineRunner {

    private static final Logger LOGGER = LoggerFactory.getLogger(App.class);

    @Override
    public void run(String... args) throws Exception {
        LOGGER.info("Hola Mundo!");
    }

    public static void main (String[] args) {
        SpringApplication.run(App.class, args);
    }
}
  1. Lista las tareas disponibles para gradle.

  2. Ejecuta la aplicación boot.

Terminal.app
$ gradle tasks (1)

$ gradle boRu (2)

YYYY-MM-DD HH:mm:ss  INFO 1049 --- [main] com.myproject.App : Hola Mundo!
YYYY-MM-DD HH:mm:ss  INFO 1049 --- [main] com.myproject.App : Started App in 10.975 seconds (JVM running for 11.303)

About

testing and tasting the Boot fruit

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%