As the title suggests, the contents when building the development environment are described. There were several articles that looked like it in the same environment, but there were times when the settings were different at key points and I couldn't run it in my environment, so I'll leave it as a memorandum.
In this article The procedure from Tomcat installation to server startup to deployment is described. The target environment is ** macOS 10.13.4 **.
Download it from Apache Tomcat (http://tomcat.apache.org/) and deploy it locally. Alternatively, install Tomcat with the brew
command (as of April 17, 2018, ** Tomcat 9.0.6 ** will be installed).
If you installed it with the brwe
command, it will be installed in the following location.
-**
Set the user (ʻuser) and role (
role`) in ** tomcat-users.xml ** to use Tomcat Manager.
** tomcat-users.xml ** is stored in the following location.
-**
<role rolename="manager-script"/>
<role rolename="manager-gui"/>
<user username="admin" password="admin" roles="manager-script,manager-gui"/>
The meaning of the roll is as follows.
- From the original document * Access to the HTML interface
- From the original document * Access to the tools-friendly plain text interface that is described in this document, and to the "Server Status" page.
For the time being, set the above role so that it can be used from the browser and tools.
Set the server (server
) in ** settings.xml ** first so that it can be accessed from the Maven plugin that will be used later.
The storage location of ** settings.xml ** varies depending on the settings, but by default it is stored in the following location.
-**
<servers>
<server>
<id>localhost</id>
<username>admin</username>
<password>admin</password>
</server>
</servers>
Set the server ID (optional) and the user name and password of the administrator user you added earlier.
Start IntelliJ and select New-> Project. Next, the [New Project] dialog is displayed. As shown in the image, select [** Maven **]-> [Create from archetype]-> [maven-archetype-webapp] and click [Next]. To do.
Enter the GroupId and ArtifactId and click Next.
If you are satisfied with the contents, click [Next].
Specify where you want to save the project and click Finish.
This is the end of project creation. When the project screen opens, it is convenient to set automatic repository download.
Next, modify ** pom.xml **. Here, we will add only the plugin.
In configuration
, specify ʻid added to
settings.xmlin
Click Edit Configurations ... in the upper right.
Select Tomcat Server-> Local from the left pane. Then click Configure in the upper right.
In the Tomcat Server dialog, for Tomcat Home, specify the Tomcat installation directory.
In this case, it will be **
Return to the [Server] screen, confirm that ** Tomcat 9.0.6 ** is displayed in [Application Server], and click [OK].
Then click the + button in the upper left and select Tomcat Server-> Local.
Enter an arbitrary setting name (demo-server) in [Name], and select ** Tomcat 9.0.6 ** in [Application Server]. Then click Deployment.
Click the [+] button. Then, in the Select Artifacts Deploy dialog, select the application (demo.war) you want to deploy and click OK.
In Application context, set the context root and click OK.
Return to the top screen, set the upper right to [demo-server], and click the Run [>] button.
The console will be output at the bottom of the screen, so check that there are no errors.
Confirm that the top page is displayed. By default, ** Hello World! ** is output.
With the flow up to this point, it was confirmed that the server started and the top screen was displayed. Next, modify the file and check the flow of deployment.
Go back to IntelliJ and fix the JSP. This time, we will modify Hello World! To Hello World !!!. Then click Maven Project-> tomcat7: deploy.
The console will be output at the bottom of the screen, so check that there are no errors.
Go back to your browser and reload the screen you were viewing earlier. Make sure it changes to Hello World !!!.
It looks like a lengthy procedure, but thank you for reading to the end.
This time, I tried to build a development environment with a configuration that was often used until now. As for me, in my current work, I am working in an environment such as Windows + Eclipse + Tomcat, so I got stuck in the Maven plug-in setting part and IntelliJ setting part, but I checked it and it works. I'm glad that I was able to confirm up to that point.
If you have any questions about this article, please let us know.
Recommended Posts