Code Monkey home page Code Monkey logo

base-starter-spring-gradle's Introduction

Vaadin Gradle Skeleton Starter Spring Boot

This project demos the possibility of having Vaadin project in npm+webpack mode using Gradle. Please see the Starting a Vaadin project using Gradle for the documentation.

Prerequisites:

  • Java 17 or higher
  • Git
  • (Optionally): Intellij Community
  • (Optionally): Node.js and npm, if you have JavaScript/TypeScript customisations in your project.
    • You can either let the Vaadin Gradle plugin to install Node.js and npm/pnpm for you automatically, or you can install it to your OS:
    • Windows: node.js Download site - use the .msi 64-bit installer
    • Linux: sudo apt install npm

Vaadin Versions

  • The v24 branch (the default one) contains the example app for Vaadin latest version
  • See other branches for other Vaadin versions.

Running With Spring Boot via Gradle In Development Mode

Run the following command in this repo:

./gradlew clean bootRun

Now you can open the http://localhost:8080 with your browser.

Running With Spring Boot from your IDE In Development Mode

Run the following command in this repo, to create necessary Vaadin config files:

./gradlew clean vaadinPrepareFrontend

The build/vaadin-generated/ folder will now contain proper configuration files.

Open the DemoApplication class, and Run/Debug its main method from your IDE.

Now you can open the http://localhost:8080 with your browser.

Building In Production Mode

Run the following command in this repo:

./gradlew clean build -Pvaadin.productionMode

That will build this app in production mode as a runnable jar archive; please find the jar file in build/libs/base-starter-spring-gradle*.jar. You can run the JAR file with:

cd build/libs/
java -jar base-starter-spring-gradle*.jar

Now you can open the http://localhost:8080 with your browser.

Building In Production On CI

Usually the CI images will not have node.js+npm available. Vaadin uses pre-compiled bundle when possible, i.e. Node.js is not always needed. Or Vaadin Gradle Plugin will download Node.js for you automatically if it finds any front-end customisations, there is no need for you to do anything. To build your app for production in CI, just run:

./gradlew clean build -Pvaadin.productionMode

base-starter-spring-gradle's People

Contributors

caalador avatar dependabot[bot] avatar manolo avatar mcollovati avatar mehdi-vaadin avatar mshabarov avatar mstahv avatar mvysny avatar taefi avatar tarekoraby avatar tltv avatar vaadin-bot avatar zhesun88 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

base-starter-spring-gradle's Issues

Spring Boot cannot be found in required version

ehaase@PROC-lnx:~/git/base-starter-spring-gradle$ gradle

FAILURE: Build failed with an exception.

  • Where:
    Build file '/home/ehaase/git/base-starter-spring-gradle/build.gradle' line: 2

  • What went wrong:
    Plugin [id: 'org.springframework.boot', version: '2.2.4.RELEASE'] was not found in any of the following sources:

  • Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
  • Plugin Repositories (could not resolve plugin artifact 'org.springframework.boot:org.springframework.boot.gradle.plugin:2.2.4.RELEASE')
    Searched in the following repositories:
    Gradle Central Plugin Repository

Gradle task bootRun must be restarted for Java changes to take effect

When changing the Java code, the Gradle task must be restarted for the change to be visible in a browser.

Steps for reproducing the issue:

  1. git clone [email protected]:vaadin/base-starter-spring-gradle.git
  2. cd base-starter-spring-gradle/
  3. ./gradlew clean bootRun
  4. See the field label "Your name" in http://localhost:8080/
  5. Change the field label in MainView.java: new TextField("Your name") โ†’ new TextField("Her name")
  6. Wait for 10 seconds.
  7. Reload the browser page http://localhost:8080/
  8. The issue: The text label has not changed to "Her name".
  9. Terminate the Gradle task: Ctrl-C
  10. ./gradlew clean bootRun
  11. Reload the browser page http://localhost:8080/
  12. See the field label "Her name" in http://localhost:8080/

Environment:

  • java: OpenJDK 64-Bit Server VM (build 11.0.16+8-post-Debian-1deb11u1, mixed mode, sharing)
  • os: Debian 11 (Bullseye)

Build fails with Java 17

The starter build fails with Java 17 (OpenJDK Temurin-17+35).

java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module @0x17b67c8e) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.co
mpiler does not export com.sun.tools.javac.code to unnamed module @0x17b67c8e

This is perhaps caused by the same reason as with the Gradle plain starter vaadin/base-starter-gradle#21.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.