title: Migrating from existing dynamic web project to gradle
body: <p>I am having an existing java dynamic web project which I created using eclipse. I usually just create a war file via eclipse and then deploy it to tomcat.</p>
  
  <p>Now I want to use Gradle to build my project and create the war file. Is there an eclipse plugin to do that? If not then how can I use gradle with my existing project?
  My existing project structure is what you get when you create a dynamic web project via eclipse and I don't want to change it.</p>
  
  <p>I have tried going through tutorials and using converting to Gradle project using gradle plugin. Can someone atleast point to a blog or tutorial or a way to start things? </p>
  
  <pre><code>   MyProject
      |java resources
      |--src
      |-- -- packages
      |-- -- .properties files
      |--test
      |-- -- packages
      |build
      |-- classes
      |WebContent
      |-- MetaINF
      |-- WEB-INF
      |-- -- lib // all my libraries are here. there is no specific repo for now
      |-- -- web.xml
  </code></pre>
  
  <p>My build.gradle :</p>
  
  <pre><code>apply plugin: 'java'
  apply plugin: 'eclipse-wtp'
  apply plugin: 'war'
  
  
  sourceCompatibility = 1.7
  targetCompatibility = 1.7
  
  
  version = '2.0'
  
  war {
  
  baseName = 'Gradle'
  version = '1.2'
  }
  repositories {
  mavenCentral()
  }
  
  repositories {
  flatDir {
     dirs 'lib'
     }
  }
  
  dependencies {
  compile group: 'commons-collections', name: 'commons-collections', version: '3.2'
  testCompile group: 'junit', name: 'junit', version: '4.+'
  
  compile files('./lib/myjar.jar')    
  compile 'commons-codec:commons-codec:1.5'
  
  compile 'commons-lang:commons-lang:2.6'
  compile 'org.hibernate:hibernate-entitymanager:4.3.8.Final'
  compile 'org.apache.axis2:axis2-kernel:1.6.2'
  compile 'org.apache.axis2:axis2-adb:1.6.2'
  compile 'com.sun.jersey:jersey-server:1.19'
  compile 'com.sun.jersey:jersey-client:1.19'
  compile 'log4j:log4j:1.2.17'
  compile 'org.apache.axis2:axis2-transport-local:1.6.2'
  compile 'org.apache.axis2:axis2-transport-http:1.6.2'
  providedCompile 'javax.servlet:servlet-api:2.3'
  
  
  
  testCompile 'junit:junit:4.9'
  testCompile 'org.jmock:jmock:2.6.0'
  testCompile 'org.jmock:jmock-junit4:2.6.0'
  testCompile 'org.jmock:jmock-legacy:2.6.0'
  
  
  
  }
  
  test {
  systemProperties 'property': 'value'
  }
  </code></pre>
  
  <p>web.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt;
   &lt;display-name&gt;Gradle&lt;/display-name&gt;
  &lt;servlet&gt;
      &lt;servlet-name&gt;HTTP REST Service&lt;/servlet-name&gt;
      &lt;servlet-class&gt;com.sun.jersey.spi.container.servlet.ServletContainer&lt;/servlet-class&gt;
      //in the above line It is showing a warning: servlet-class references to non-existent class "com.sun.jersey.spi.container.servlet.ServletContainer"
      &lt;init-param&gt;
         &lt;param-name&gt;com.sun.jersey.config.property.packages&lt;/param-name&gt;
         &lt;param-value&gt;org.gradle&lt;/param-value&gt;
     &lt;/init-param&gt;
  
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  
  
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;HTTP REST Service&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p></p>
  
  <p>My proj structure 
      <img src="https://i.stack.imgur.com/wrZ6C.png" alt="Project Structure"></p>