Build a WEB application with Gradle under Eclipse

Source: Internet
Author: User

Create a new Dynamic Web project, create a new Build.gradle file under the project root directory, and write to it as follows:

Import Org.gradle.plugins.ide.eclipse.model.Facet Apply plugin: ' java ' Apply plugin: ' War ' Apply plugin: ' ECLIPSE-WTP ' so   Urcecompatibility = 1.7//Set JDK version webappdirname = ' webcontent '//Set WebApp root sourceSets.main.java.srcDir ' src ' Set Java source directory//Set MAVEN library address repositories {mavencentral ()//Central Library//maven {URL ' <a href= ' Http://maven.osc hina.net/content/groups/public/' "target=" _blank ">http://maven.oschina.net/content/groups/public/' </a> }//Custom library Address}//Set dependent dependencies {providedcompile ' javax.servlet:servlet-api:2.5 '//Compile period providedruntime ' javax.se rvlet:jstl:1.2 '//runtime}//Set Project Facetseclipse {wtp {facet {facet name: ' Jst.web ', type: Facet.FacetType.fixed facet name: ' Wst.jsdt.web ', type:Facet.FacetType.fixed facet name: ' Jst.java '  , type:Facet.FacetType.fixed facet name: ' Jst.web ', Version: ' 3.0 ' Facet name: ' Jst.java ', version: ' 1.7 ' facet name: ' WST. Jsdt.web ', Version: ' 1.0 '}} 

  

2. Next right-click on the project, convert to Gradle project configure

3. Right click on Project again, Gradle, Refresh all

4. If you do not have the Web. xml file, then right-click the project, Java EE Tools, Generate Deployment descriptor Stub

5. Finally see how the effect, in WebContent under the new index.jsp to write something, and then on the project right-click Run as--run on Server

Build a WEB application with Gradle under Eclipse

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.