How to create a server executable JAR and WAR with Spring gradle

Spring boot executable Jar

Environment: macOS, Spring Tools Right-click on the Package Explorer project name.

Run as ⇨ Run Configuration Right click on Gradle Project. Click the Gradle Tasks tab. Write build in the Gradle Tasks: field.

Specify the root folder of the project in the Working Directory field. Click Run at the bottom right.

Then

Project root / build / libs

The project name.jar is created in.

(Trying below) Upload to server Upload to any of the above folders.

terminal


java -jar test.jar  

When executed with, tomcat built in the jar starts up. Control + c to stop the server But in my case, when I ran it, the app started up and seemed to work, and when I accessed the page, there was no response.

Spring Boot Executable War

Change the menu when creating a new project or the place where jar is specified in build.gradle to war. in build.gradle

build.gradle


apply plugin:'war'
war {
        enabled = true
        archiveName 'sample.war'
    }

Add Refresh gradle and open configuration with the same procedure as for jar

Write war in the Gradle Tasks: column. Then in the same way

There is a war file in the project root / build / libs.

Recommended Posts

How to create a server executable JAR and WAR with Spring gradle
How to create a jar file or war file using the jar command
How to create a new Gradle + Java + Jar project in Intellij 2016.03
How to check before sending a message to the server with Spring Integration
Create a web api server with spring boot
[Spring sample code included] How to create a form and how to get multiple records
How to create an Excel form using a template file with Spring MVC
How to create a Spring Boot project in IntelliJ
[Spring Boot] How to create a project (for beginners)
How to install Gradle and Kotlin with SDKMAN (Mac)
How to create a method
Getting started with Gradle (until you create a Java project and combine external libraries into one executable JAR)
I tried to create a shopping site administrator function / screen with Java and Spring
Create a Java Servlet and JSP WAR file to deploy to Apache Tomcat 9 in Gradle
Generate a single executable jar with dependent libraries in Gradle 4.9
How to create and launch a Dockerfile for Payara Micro
How to read a library from a JAR file with VS Code << How to not use Maven / Gradle >>
[Java] How to create a folder
How to make a jar file with no dependencies in Maven
How to create your own Controller corresponding to / error with Spring Boot
How to load a Spring upload file and view its contents
Create a flyway jar with maven and docker build (migrate) with docker-maven-plugin
How to create a web server on an EC2 instance on AWS
Create a jar file with the command
How to create a Maven repository for 2020
[Swift5] How to create a splash screen
[rails] How to create a partial template
Add spring boot and gradle to eclipse
How to interact with a server that does not crash the app
[Java] Create a jar file with both compressed and uncompressed with the jar command
[Docker] How to create a virtual environment for Rails and Nuxt.js apps
Create a program to post to Slack with GO and make it a container
[Rails] How to create a table, add a column, and change the column type
How to make an app with a plugin mechanism [C # and Java]
How to create a convenient method that utilizes generics and functional interfaces
[Spring Boot] Precautions when developing a web application with Spring Boot and placing war on an independent Tomcat server
How to download and run a Jar package directly from the Maven repository with just the command line
What to do if zip dies if there is a pom when making an executable jar with gradle
How to create a database for H2 Database anywhere
Create a simple search app with Spring Boot
[Rails] rails new to create a database with PostgreSQL
[Rails] How to create a graph using lazy_high_charts
How to use MyBatis2 (iBatis) with Spring Boot 1.4 (Spring 4)
How to use built-in h2db with spring boot
How to output jar with main class specified by gradle in Intellij IDEA
How to create pagination for a "kaminari" array
How to deploy a system created with Java (Wicket-Spring boot) to an on-campus server
How to create a class that inherits class information
How to create multiple pull-down menus with ActiveHash
How to add a classpath in Spring Boot
How to create a theme in Liferay 7 / DXP
[1st] How to create a Spring-MVC framework project
How to easily create a pull-down in Rails
[Rails] How to create a Twitter share button
Getting started with Maven (until you create a Java project and combine external libraries into a single executable JAR)
How to build API with GraphQL and Rails
I wanted to gradle spring boot with multi-project
Try to display hello world with spring + gradle
How to create member variables with JPA Model
How to specify a tag containing a colon (:) and namespace with Nokogiri's css selector
How to build an executable jar in Maven