[JAVA] I tried to create a Spring MVC development environment on Mac

Introduction

――For various reasons, I created a Spring development environment. ――It was a break, but I was able to build it in a total of about 3 or 4 hours while fitting smoothly. ――I would like to continue to promote Spring-related activities in the future.

environment

# OS/software/Library version
1 Mac OS X EI Capitan
2 Java 1.8.0_111
3 Tomcat 8.0.43
4 Eclipse 4.5 Mars
5 Maven 3.5.2
6 Spring 3.1.1.RELEASE

Various installations from Homebrew

Update brew

brew update && brew upgrade && brew cleanup

Java

Installation

brew cask install java

PATH setting

export JAVA_HOME=`/usr/libexec/java_home -v 1.8`

Tomcat

Installation

brew install tomcat

Maven

Installation

brew install maven

PATH setting

export M2_HOME=/usr/local/Cellar/maven/3.5.2/
export M2=$M2_HOME/bin
export PATH=$M2:$JAVA_HOME:$PATH

Eclipse installation

Download Mars

https://www.eclipse.org/downloads/packages/release/Mars/2

Installation

Place Eclipse.app under / Applications.

Download various plug-ins

** Japanese localization plug-in ** http://mergedoc.osdn.jp/#pleiades.html

JStyle http://mergedoc.osdn.jp/#jstyle.html

Localizing into Japanese

Place the jp.sourceforge.mergedoc.pleiades directory of the unzipped plugin under /Applications/Eclipse.app/Contents/Eclipse/plugins/.

Open /Applications/Eclipse.app/Contents/Eclipse/eclipse.ini and add the writing.

-Xverify:none
-javaagent:/Applications/Eclipse.app/Contents/Eclipse/plugins/jp.sourceforge.mergedoc.pleiades/pleiades.jar

JStyle

Place the unzipped plugin jar under /Applications/Eclipse.app/Contents/Eclipse/plugins/.

Initial setup of Eclipse

After starting, open the environment settings at the top left of the screen.

--From "Java> Compiler", change the Java version to 1.8. --Add Java SE 8 from "Java> Installed JRE". --Adjust the "General> JStyle" settings. --Set "General> Web Browser". --If proxy settings are required, set "General> Network Connection".

Tomcat connection settings

After booting, open "Server> Runtime Environment" from the Preferences at the top left of the screen.

  1. Select "Apache> Apache Tomcat v8.0" from Add and proceed.
  2. Enter the name and Tomcat installation directory. The directory is as follows.
/usr/local/Cellar/[email protected]/8.0.43/libexec

Install Spring and Maven plugins

STS installation

  1. Open Help> Eclipse Marketplace at the top of the screen.
  2. Enter STS in the search window to install.

Install Maven plugin

  1. Open "Help> Install New Software" at the top of the screen.

  2. Enter STS in the search window to install.

  3. Open the Project Explorer from Window> Show View on the screen.

  4. Set the following from the add button and install.

Maven
http://download.eclipse.org/technology/m2e/releases

Creating a Spring project

  1. Open File> New> Spring Legacy Project at the top of the screen.
  2. Enter the project name, select Spring MVC Project from the template and proceed.
  3. Enter the package name and you're done.

Initial setup of the project

Right-click on the project and open its properties.

--Change the Java version from "Java Compiler" to 1.8. --Add Java SE 8 from "Java Build Path".

Dependency installation

  1. Right-click on the project and run "Run> Maven clean".
  2. Similarly, execute "Run> Maven install".

Launch project

  1. Right-click on the project and select Run> Run on Server.
  2. From Manually define a new server, select Apache> Apache Tomcat v8.0 and proceed.
  3. Add the project to preconfigured and complete. If the following page is displayed, it is successful.

FireShot Capture 065 - Home - http___localhost_8080_app_.jpg

Points that fit, points that I did not understand well

--Introduction of Eclipse

There are many options for Eclipse, such as using various versions and Pleades directly, downloading from the original home or installing from Homebrew.

--How to make a project

At first, it was promoted from Maven project to Spring environment, but I wasn't sure because there are various setting methods. Also, it became much easier because I found a package that can create templates such as STS on the way.

--Tomcat runs normally

When I played around with it, the execution environment broke, and I didn't know where to play with it. It is good to erase the workspace and start over.

--How to resolve the dependency

I was lucky enough to know that I needed to install it using Maven, not just adding it to pom.xml.

What I don't understand well

--Differences between Spring, Spring MVC, Spring Boot, etc.

If you don't squeeze it properly when you check this area, it may fit.

--Difference between Maven and Gradle

I tried using Gradle, but do I have to set the xml by myself? Maven was all made of screen pops.

Recommended Posts

I tried to create a Spring MVC development environment on Mac
I tried to create a java8 development environment with Chocolatey
I tried to create a padrino development environment with Docker
Create a Java development environment using jenv on Mac
[First environment construction] I tried to create a Rails 6 + MySQL 8.0 + Docker environment on Windows 10.
I tried to create React.js × TypeScript × Material-UI on docker environment
Build a Java development environment on Mac
I tried to create a LINE clone app
I tried running Java on a Mac terminal
Create a Spring Boot development environment with docker
I tried to build a Firebase application development environment with Docker in 2020
I tried migrating the portfolio created on Vagrant to the Docker development environment
Let's create a gcloud development environment on a centos8 container
I tried to create a Clova skill in Java
Build a development environment to create Ruby on Jets + React apps with Docker
I tried to create a shopping site administrator function / screen with Java and Spring
I tried adding a separator line to TabLayout on Android
[Rails] I tried to create a mini app with FullCalendar
Install Java development environment on Mac
[Rails 6.0, Docker] I tried to summarize the Docker environment construction and commands necessary to create a portfolio
I tried printing a form with Spring MVC and JasperReports 1/3 (JasperReports settings)
I tried printing a form with Spring MVC and JasperReports 3/3 (Spring MVC control)
I tried to create a simple map app in Android Studio
A story of frustration trying to create a penetration environment on Ubuntu 20.04
I tried connecting to MySQL using JDBC Template with Spring MVC
I tried to build an http2 development environment with Eclipse + Tomcat
Create a development environment for Ruby 3.0.0 and Rails 6.1.0 on Ubuntu 20.04.1 LTS
Steps to build a Ruby on Rails development environment with Vagrant
I tried to build a laravel operating environment while remembering Docker
Java development environment construction memo on Mac
Create Spring Boot-gradle-mysql development environment with Docker
Let's create a Java development environment (updating)
[Ruby] Building a Ruby development environment on Ubuntu
I tried to take a look at the flow of Android development environment construction with Android Studio
I tried to build AdoptOpenjdk 11 on CentOS 7
Build a JMeter environment on your Mac
I tried printing a form with Spring MVC and JasperReports 2/3 (form template creation)
How to build a Ruby on Rails development environment with Docker (Rails 6.x)
Gorigori SIer SE tried to create a Web service by personal development
How to build a Ruby on Rails development environment with Docker (Rails 5.x)
Create a java web application development environment with docker for mac part2
I tried Spring.
I tried using Junit on Mac VScode Maven
java I tried to break a simple block
Building a Ruby environment for classes on Mac
I tried to develop a man-hour management tool
I tried to develop a DUO3.0 study website.
Rails6.0 ~ How to create an eco-friendly development environment
I tried running Ansible on a Docker container
I tried to link JavaFX and Spring Framework.
Ruby on Rails development environment construction on M1 Mac
I tried to create Alexa skill in Java
I tried to develop a website to record expenses.
How to build a Pytorch environment on Ubuntu
I tried to implement a server using Netty
I tried to break a block with java (1)
I tried to create a portfolio with AWS, Docker, CircleCI, Laravel [with reference link]
I built a Java EE environment on AWS and tried running a web application
I tried printing a form with Spring MVC and JasperReports Extra edition (Variables edition)
I want to create the strongest local development environment using VSCode Remote Containers
I tried printing a form with Spring MVC and JasperReports Extra edition (image edition)