Eclipse che developing spring web App (Getting started) (ii)

Source: Internet
Author: User
Tags eclipse che

In the previous blog we described how to install Eclipse che this browser SDK, received a lot of developer's questions, in order to facilitate the development of Java Spring Web application for beginners, the author has a step-by-step implementation of the Spring Web Development (demo) process, welcome correction. Using Eclipse Che requires you to master the basic MAVEN commands (which can be easily mastered if you used ant). This article describes how to develop the spring Web with Eclipse Che, and developers need to understand the basics of spring. The blog post consists of several parts: 1. Spring Demo Project creation, 2. Compiling and deploying, 3. Running the Web app, 4. Summary


1. Create a Spring Web project (DEMO)

go to the workspace directory, workspace---Create project--web Java spring, as follows:


Click Next to complete the creation:

The first time you open, Creetingcontroller.java will have a lot of red errors, because you can't find a dependent library, this background from maven repo download dependent library, and so on after all dependent download will be displayed normally. As follows:

In fact, the Linux dependency library is placed under: ~/.m2/respository (the person who knows Maven skipped). (Open consoles Input related commands, example below)



2.maven Compilation and Deployment

Create a cmd (the installation of Eclipse Che has been introduced), the command is as follows (the default CP to WebApps, saved as Root.war, can be changed to a web name, such as Testspring.war):

Mvn-f ${current.project.path} clean install && cp ${current.project.path}/target/*.war $TOMCAT _home/webapps/ Root.war

The actual input command is: Clean install && cp ${current.project.path}/target/*.war $TOMCAT _home/webapps/root.war (e.g. configuration command)

Note: The default tomcat_home is already configured to complete. You can see the path in the consoles (echo $TOMCAT _home)



Complete compilation and deployment (console output is as follows)


3. Run the Web service

3.1. Start the Tomcat8 container in the Dev Machine environment (Docker)

You can start tomcat8 in terminal with command, that is, by default in the Home User directory (/HOME/USER/TOMCAT8), start the script in the bin directory startup.sh

3.2. In the Tomcat8 WebApps directory, you see a root.war for just copy of the past Testspring project after the compilation of the war, start automatically after the WebApps decompression to root (Root app)

3.3. In the upper right corner of the workspace, there is a blue toggle button that allows you to view the mappings between Tomcat8 addresses and native addresses in Docker, such as:



You can know that the Docker tomcat8 8080 corresponds to the address and port, typing the address in the local browser: http://192.168.99.100:32769, display the following interface, indicating that the application was published successfully. If the publication is unsuccessful, check to see if the TOMCAT8 is started.



OK, test application no problem (can be relieved, haha)!

For users who are just getting started, there may be some confusion

Local address is applied in 1.docker, the VM has been assigned the address by default after installation

2. The default docker is no boot tomcat8, so the direct http://192.168.99.100:32769, is unable to open the Web page, check whether TOMCAT8 open can use the following command (both can):

A. Anyone familiar with Java knows that using the JPS command to view Java processes, such as (command: JPS-VL), the red box is the TOMCAT8 service, indicating that it is started. You may notice that there is also a process, in fact, for the ws-agent, that is, workspace-agent, for Docker and run Che.bat docking agent



B. The general default Tomcat is 8080 service port, with netstat-apn| grep 8080 It is also possible to see if Tomcat is started. The red box indicates that the local 8080 port has started listening, and the service with the remote 192.168.99.1:8080 bit ws-agent docking with Eclipse Che, as explained above


4. Summary

Overall, it's relatively simple to run a Web application through Eclipse che. In the process of using CHE, the author has made it easy to use Che's relatively traditional SDK mode, so it can be developed anytime, anywhere (as long as it can be connected), and Eclipse Che has been integrated with Git and Docker in a natural way. One-click concatenation of several processes involved in the entire team development process: versioning, compiling, deploying, and running. Of course, the current Eclipse Che feature is not very perfect, expecting a new version to appear!

This article through a simple spring Demo Web application, hope to play the role of throwing jade, encourage people to actively try to develop with eclipse Che.

Have a question welcome message, Thank you!

Reprint Annotated Source: http://blog.csdn.net/ccfeng2008/article/details/51338679

Eclipse che developing spring web App (Getting started) (ii)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.