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