[Azure] I tried to create a Java application for free-Web App creation- [Beginner]

◇ Overview

In this article, we'll use Azure to create a java web app for free. If you don't have an Azure subscription Please create a Free Account before you start.

[Azure] I tried to create a Java application for free

** [Azure] I tried to create a Java application for free-Web App creation- [Beginner] **: point_left_tone1: Now here: bangbang: -Create a "java" web app using "App Service" ・ Display up to "Hello world !!" on the TOP page

[Azure] I tried to create a Java application for free-Connect by FTP- [Beginner] -Connect to the previously created "java" web application by FTP ・ Change "Hello world !!" on the TOP page

~ Schedule for the next time and later ~ [Azure] I tried to create a Java application for free ~ Git edition ~ [Beginner] [Azure] I tried to create a Java application for free ~ SQL Server ~ [Beginner]

◇ Create App Service

-Open Portal in your browser

-Select "Add" in "Home> App Service"

・ Enter and select items.

・ If there are no mistakes in the content, select "Confirm and create"

· Move to resource when deployment is complete

-Click the URL displayed as "https: // .azurewebsites.net" in the overview. If it looks like the image below, it's OK!

-Click Quickstart displayed on the created site.

◇ Creating a Java application * Refer to the official document

Work on the official document "Quick Start> Create Java App" as follows. [Official] Creating Java Web Apps on Linux-Azure App Service | Microsoft Docs

* It may be changed to the official document, so please be aware of it with assistance! </ font>

◆ Use Azure Cloud Shell

-Start Cloud Shell. (On PortalScreenshot_2019-10-08 Microsoft Azure (5) .png -1.amazonaws.com/0/197404/8ddf185d-b69c-1052-ab81-4a395ab38056.png) so open it) Screenshot_2019-10-08 Microsoft Azure(6).png

◆ Create a Java app

Run the following Maven command at the Cloud Shell prompt to create a new app named helloworld

  • If the upper left of Cloud Shell (black screen) is other than "Bash", change it to "Bash" Screenshot_2019-10-10 https qiita-image-store s3 ap-northeast-1 amazonaws com 0 197404 6cde447a-1048-0900-79d6-535f28652f11[...].png

bash


//Check that the helloworld directory exists
//(If it exists, an error will occur with mvn archetype)
ls -a

//Create a new app
mvn archetype:generate -DgroupId=example.demo -DartifactId=helloworld -DarchetypeArtifactId=maven-archetype-webapp

//Check if helloworld is created
ls -a

◆ Configure Maven plugin

Open the project pom.xml file in the helloworld directory.

bash


// 'helloworld'Transition to directory
cd helloworld

// pom.Open xml file
code pom.xml

Next, add the following plugin definition inside the element of the pom.xml file.

pom.xml


<plugins>
    <!--*************************************************-->
    <!-- Deploy to Tomcat in App Service Linux           -->
    <!--*************************************************-->
    <plugin>
        <groupId>com.microsoft.azure</groupId>
        <artifactId>azure-webapp-maven-plugin</artifactId>
        <version>1.7.0</version>       
    </plugin>
</plugins>

Next, configure the deployment and at Command Prompt Execute the maven command mvn azure-webapp: config and Confirm (Y / N) (Confirm (Y / N)) Until the prompt is displayed Press Enter to use the default configuration and press y to complete the configuration.

bash


mvn azure-webapp:config

//The following is displayed
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< example.demo:helloworld >-----------------------
[INFO] Building helloworld Maven Webapp 1.0-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- azure-webapp-maven-plugin:1.7.0:config (default-cli) @ helloworld ---
[WARNING] The plugin may not work if you change the os of an existing webapp.
Define value for OS(Default: Linux):
1. linux [*]
2. windows
3. docker
Enter index to use:
Define value for javaVersion(Default: jre8):
1. jre8 [*]
2. java11
Enter index to use:
Define value for runtimeStack(Default: TOMCAT 8.5):
1. TOMCAT 9.0
2. jre8
3. TOMCAT 8.5 [*]
4. WILDFLY 14
Enter index to use:
Please confirm webapp properties
AppName : helloworld-1558400876966
ResourceGroup : helloworld-1558400876966-rg
Region : westeurope
PricingTier : Premium_P1V2
OS : Linux
RuntimeStack : TOMCAT 8.5-jre8
Deploy to slot : false
Confirm (Y/N)? : Y

Go to pom.xml again and verify that the plugin configuration has been updated. If desired, you can modify other App Service configurations directly in the pom file. Here are some common ones:

  • Check the plan and app name that was set first (may have changed) <pricing Tier> <appName> <resourceGroup> Please check! !! !!

bash


code pom.xml

Screenshot_2019-10-08 Linux での Java Web アプリの作成 - Azure App Service.png

◆ Deploy application

Deploy your Java app to Azure using the following command:

bash


mvn package azure-webapp:deploy

After the deployment is complete, browse to the deployed application using the following URL in your web browser:

If "Hello World!" Is displayed on "https: // .azurewebsites.net", it's OK! スクリーンショット 2019-10-08 17.35.41.png

**! !! !! Completed! !! !! ** **

Related article

-[Azure] I tried to create a Java application for free-Web App creation- [Beginner] -[Azure] I tried to create a Java application for free ~ Connect with FTP ~ [Beginner] -[Azure] I tried to create a Java application for free ~ Git edition ~ [Beginner] -[Azure] I tried to create a Java application for free ~ SQL Server ~ [Beginner]

Quote

[Official] Creating Java Web Apps on Linux-Azure App Service | Microsoft Docs

Recommended Posts

[Azure] I tried to create a Java application for free-Web App creation- [Beginner]
[Azure] I tried to create a Java application for free ~ Connect with FTP ~ [Beginner]
I tried to create a LINE clone app
I tried to create a Clova skill in Java
I tried to create a java8 development environment with Chocolatey
I tried to modernize a Java EE application with OpenShift.
[Rails] I tried to create a mini app with FullCalendar
I tried to create a simple map app in Android Studio
I want to create a chat screen for the Swift chat app!
Java beginner tried to make a simple web application using Spring Boot
I tried to make a talk application in Java using AI "A3RT"
java I tried to break a simple block
I tried to create Alexa skill in Java
I tried to break a block with java (1)
I want to create a generic annotation for a type
How to create a lightweight container image for Java apps
[Beginner] I made a program to sell cakes in Java
I tried to implement a buggy web application in Kotlin
I tried to make a client of RESAS-API in Java
I tried to create a padrino development environment with Docker
I made a shopify app @java
I tried to interact with Java
[Java] How to create a folder
Try to create a server-client app
I tried to summarize Java 8 now
I tried to create a Spring MVC development environment on Mac
I made a method to ask for Premium Friday (Java 8 version)
I tried to build a simple application using Dockder + Rails Scaffold
I tried to make an Android application with MVC now (Java)
[Java] I tried to make a maze by the digging method ♪
I want to develop a web application!
I tried to make a simple face recognition Android application using OpenCV
I tried to introduce CircleCI 2.0 to Rails app
[Rails6] Create a new app with Rails [Beginner]
I tried Cassandra's Object Mapper for Java
I tried to summarize Java lambda expressions
How to create a Maven repository for 2020
I want to create a dark web SNS with Jakarta EE 8 with Java 11
Create a TODO app in Java 7 Create Header
[JDBC] I tried to make SQLite3 database access from Java into a method for each SQL statement.
[Rails 5] Create a new app with Rails [Beginner]
Volume of trying to create a Java Web application on Windows Server 2016
Create a java web application development environment with docker for mac part2
I tried to create a method to apply multiple filters at once with Java Stream API. Is this okay?
When I wanted to create a method for Premium Friday, it was already in the Java 8 standard API
I tried to make a program that searches for the target class from the process that is overloaded with Java
Let's create a TODO application in Java 2 I want to create a template with Spring Initializr and make a Hello world
I tried to create a portfolio with AWS, Docker, CircleCI, Laravel [with reference link]
I tried to make a machine learning application with Dash (+ Docker) part3 ~ Practice ~
[First environment construction] I tried to create a Rails 6 + MySQL 8.0 + Docker environment on Windows 10.
[Rails / JavaScript / Ajax] I tried to create a like function in two ways.
I want to play a GIF image on the Andorid app (Java, Kotlin)
I built a Java EE environment on AWS and tried running a web application
I tried to clone a web application full of bugs with Spring Boot
[Small story] I tried to make the java ArrayList a little more convenient
I made a Diff tool for Java files
How to create a database for H2 Database anywhere
Connect to Aurora (MySQL) from a Java application
Deploy Java web app to Azure with maven
I tried to develop a man-hour management tool
I did Java to make (a == 1 && a == 2 && a == 3) always true