[Windows] [IntelliJ] [Java] [Tomcat] Create a Tomcat9 environment with IntelliJ

Java and Tomcat Elementary Notes

official

Apache Tomcat® - Welcome!

Verification environment

Type version
OS Windows 10 64bit
JDK jdk1.8.0_121
IDE IntelliJ IDEA 2017.1.3
Tomcat 9.0.0.M21

Install tomcat

This time, I verified it with the latest Tomcat 9. Apache Tomcat® - Apache Tomcat 9 Software Downloads

Install the 32-bit / 64-bit Windows Service Installer on the download page.

During the installation, add an admin account and this time use it for authentication.

Add deployment destination server settings

Add the server settings that Maven goes to browse. Add the following to C: \ Users \ user \ .m2 \ settings.xml. ʻId is optional. ʻUsername / password is added once with the admin account.

Add tomcat account


    <servers>
        <server>
            <id>localhost</id>
            <username>user</username>
            <password>pass</password>
        </server>
    </servers>

Maven – Settings Reference

Create a new project in IntelliJ

Select maven-achetype-webapp in new Maven project

image.png

Modify pom.xml

After creating the project, add the following to pom.xml.

pom.xml


  <build>
    <finalName>test3</finalName>
    <!--Add the following-->
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.6.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
          <encoding>UTF-8</encoding>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.tomcat.maven</groupId>
        <artifactId>tomcat7-maven-plugin</artifactId>
        <version>2.2</version>
        <configuration>
          <server>localhost</server>
          <url>http://localhost:8080/manager</url>
          <path>/${project.build.finalName}</path>
        </configuration>
      </plugin>
    </plugins>
  </build>

maven-compiler-plugin => Explicitly specify version (1.8 this time) tomcat7-maven-plugin => Specify the server to deploy to

After adding the plugin settings, run Maven Reimport

image.png

Added deployment settings when building IntelliJ

Add settings from ʻEdit Configurations`

image.png

Select Tomcat Server from Add +

image.png

ʻSpecify the Tomcat 9 installed on Application Server`.

image.png

In the Deployment tab in the same settings, specify the artifact (* .war) generated by the project.

image.png

ʻSpecify the application name in Apptication Context. (TODO: If you leave /`, the initial screen of Tomcat will be displayed)

image.png

Execute

If you execute the build with the settings completed, it will be executed with the war file deployed on Tomcat.

image.png

Modify ʻindex.jsp` as follows.

index.jsp


<html>
<body>
<h2>Hello World!!!</h2>
<%= new java.util.Date() %>
</body>
</html>

I was able to confirm that it was reflected.

image.png

Summary

I think it's rough because it's my first year, but for the time being I was able to build a minimum environment.

reference

Servlet / Introduction to JSP: Java server-side application I tried deploying a web application to Tomcat using IntelliJ IDEA-Qiita 5. Real application development with Maven | TECHSCORE

Recommended Posts

[Windows] [IntelliJ] [Java] [Tomcat] Create a Tomcat9 environment with IntelliJ
[Note] Create a java environment from scratch with docker
Build a Tomcat 8.5 environment with Pleiades 4.8
Create RUNTEQ's environment with Windows DockerDesktop
Deploying a Java environment with Windows Subsystem for Linux (WSL)
I tried to create a java8 development environment with Chocolatey
Create a MySQL environment with Docker from 0-> 1
Let's create a Java development environment (updating)
I can't create a Java class with a specific name in IntelliJ
[Memo] Create a CentOS 8 environment easily with Docker
Create a CSR with extended information in Java
Create a simple bulletin board with Java + MySQL
Let's create a timed process with Java Timer! !!
[Java] Create a filter
[Java] Create a collection with only one element
Prepare a scraping environment with Docker and Java
Create Spring Boot environment with Windows + VS Code
Create a java web application development environment with docker for mac part2
Create a Spring Boot development environment with docker
Build a Java development environment with VS Code
Create a Java development environment using jenv on Mac
How to create a Java environment in just 3 seconds
[Beginner] Create a competitive game with basic Java knowledge
Create a Java, JavaScript team development environment (problem raising)
[Environment construction] Build a Java development environment with VS Code!
Create Chisel development environment with Windows10 + WSL2 + VScode + Docker
Create a java method [Memo] [java11]
[Java] Create a temporary file
Create a playground with Xcode 12
Ruby ① Build a Windows environment
Resolve CreateProcess error = 206 when running Java in a Windows environment
Create a SlackBot with AWS lambda & API Gateway in Java
Build a "Spring Thorough Introduction" development environment with IntelliJ IDEA
Create a Java and JavaScript team development environment (gradle environment construction)
I tried to create a padrino development environment with Docker
Zip compression with Java in Windows environment without garbled characters
Create a simple DRUD application with Java + SpringBoot + Gradle + thymeleaf (1)
Build a Java project with Gradle
Build a Node.js environment with Docker
Let's create Ubuntu environment with vmware
Create a tomcat project using Eclipse
Install Java with zip on Windows
Prepare Java development environment with Atom
Create a database in a production environment
Create SolrCloud verification environment with Docker
Create a Java project using Eclipse
[Java] How to create a folder
Java environment variable settings (Windows, AdoptOpenJDK11)
Create Laravel environment with Docker (docker-compose)
Create exceptions with a fluid interface
Create a Maven project with a command
Create a simple web server with the Java standard library com.sun.net.httpserver
Create a memo app with Tomcat + JSP + Servlet + MySQL using Eclipse
Create a high-performance enum with fields and methods like Java with JavaScript
How to create a new Gradle + Java + Jar project in Intellij 2016.03
Building a haskell environment with Docker + VS Code on Windows 10 Home
Look through Java and MySQL PATH with environment variables [Windows version]
[Java] Create and apply a slide master
Create a web environment quickly using Docker
Let's install Docker on Windows 10 and create a verification environment for CentOS 8!
Build a Windows application test environment with Selenium Grid, Appium, and Windows Application Driver