How to build a Web application with Gradle under MyEclipse

Source: Internet
Author: User

First, install the Gradle plug-in, refer to my other article: MyEclipse Integrated Gradle development environment

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

1 Import Org.gradle.plugins.ide.eclipse.model.Facet2 3 Apply plugin: ' java '4 Apply plugin: ' War '5 Apply plugin: ' ECLIPSE-WTP '6 7 sourcecompatibility = 1.7//Set JDK version8 webappdirname = ' WebRoot '//Set WEBAPP root directory9 sourceSets.main.java.srcDir ' src '//Set the directory where Java source code residesTen  One //Set MAVEN library address A Repositories { - //Central Library - mavencentral () the //Custom library address - //Maven {URL ' http://maven.oschina.net/content/groups/public/'} - } -  + //Set dependencies - Dependencies { + providedcompile ' javax.servlet:servlet-api:2.5 '//compile period A providedruntime ' javax.servlet:jstl:1.2 '//Runtime at } -  - //Set Project Facets - Eclipse { - WTP { - Facet { in facet name: ' Jst.web ', type:Facet.FacetType.fixed - facet name: ' Wst.jsdt.web ', type:Facet.FacetType.fixed to facet name: ' Jst.java ', type:Facet.FacetType.fixed + facet name: ' Jst.web ', Version: ' 3.0 ' - facet name: ' Jst.java ', version: ' 1.7 ' the facet name: ' Wst.jsdt.web ', Version: ' 1.0 ' *         } $     }Panax Notoginseng}

Third, next right click on the project, convert to Gradle project configure

Iv. again on the project right click, Gradle, Refresh all

If there is no web. xml file in the Webroot-to-web-inf directory, then right-click the item--myeclipse--Generate Deployment descriptor Stub

The final deployment project runs to see how it works, or you can right-click on the project, run as, MyEclipse server application to select the Web application server that is running.

How to build a Web application with Gradle under MyEclipse

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.