Project Automation Construction Tool Gradle Getting started 5--doing a gradle Web project in IntelliJ

Source: Internet
Author: User

A few of the previous sections are purely hand-crafted folders, purely hand-copied war packages, or a purely manual decompression zip to see the results,,, this is still I wrote to play the HelloWorld. If you play the big project, the team of dozens of people in co-development, so play,,,, the grumpy programmer estimates the blood pressure to explode the watch.

For larger Java Web projects, we need to use Tomcat 9.0 m10,gradle 3.2.1,intellij to get this done.

1, software download installation, see < project Automation construction tools Gradle Get started 0--environment & nonsense >.

2. Open Intellij,file, New Project and pop up the interface as shown:

3, as shown, put 2 groove on, select the Gradle we downloaded to the decompression address. Finish as shown, press Next, go to the next step, fill in the project name and click Finish. I'm using a lionweb.

4. Double-click the Build.gradle file in the project directory tree on the left, as shown in:

5, we will write the red pen to the Java War, let Gradle to us to compile Java Web Project bar. Yes, IntelliJ is automatically saved by default, so you don't need to press save. Then we open the Gradle panel and double-click Build, as shown in.

6, this time we saw the left Project Day directory tree updated. We create new folders and files in the directory as shown in:

7, the index.html shown, the code is as follows:

<! DOCTYPE html>

  

8, now, we can generate the war package, double-click the Gradle panel assemble. Then on the left side of the project directory tree, see that the war package is out. As shown in the following:

9. We can now copy this war to Tomcat's WebApp directory to see if we can run,

With the Lionweb-1.0.war of the project tree selected, the right-click menu-copy. Go to Windows Tomcat under the WebApp directory, right-click-paste. As shown

10. Enter Tomcat's Bin directory, execute Startup.bat, and then enter localhost:8080/lionweb-1.0/index.html in the browser

11, to prove that we did nothing wrong, the resulting war pack wood has problems. But it's not acceptable for the old man to copy the war to Tomcat, we have to configure the Tomcat server to get IntelliJ to do the work for us.

IntelliJ Configuring Tomcat
1. Add a running environment, click the drop-down button next to the run in the top right corner, then click Edit configurations ... As shown in the following:

2, Pop Up the dialog box, click on the Left Add button, add a tomcat server:

3, enter the interface as shown, fill in the name of the Tomcat server, the other default, click OK.

4. Switch to the Deployment tab page, click the Add button on the right, and then find the war package you want.

5. Configure the directory to change the war package under Tomcat Server, Simple is/, root directory.

6, back to the main interface, as shown, click the drop-down button, select Fill in the name Tomcat9, and then click on the right side of the run triangle icon, such as the steps of the step.

7, at this time, the browser will automatically pop out, displayed as:

Ok,intellij helped us get the job done with the deployment. We try to change the next index.html, then click Run Assemble again, then click Run Tomcat9, select Redeploy. Refresh under the popup page, is not updated? The steps are as follows:

Sure enough, Gaga:

Project Automation Construction Tool Gradle Getting started 5--doing a gradle Web project in IntelliJ

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.