title: Gradle create war and jar from same project
body: <p>Im creating a java rest service using spring mvc, gradle and tomcat. I want to create a war from this project to be deployed in tomcat, and I want a jar from all model packages. I managed to create war and it works well. But I don't know to create a jar from my specified classes to be used as a client jar. I know i have to use <strong>include('com/a/b/**/model/**')</strong> for selecting classes but thats all. This jar i want to be installed in .m2 local repo so it can be used as a dependency for another projects. Below is my <strong>build.gradle</strong> file:</p>
  
  <pre><code>apply plugin: 'java'
  apply plugin: 'eclipse'
  apply plugin: 'war'
  apply plugin: 'maven'
  apply from: 'dependencies.gradle'
  
  sourceCompatibility = 1.7
  targetCompatibility = 1.7
  
  repositories {
       mavenCentral()
       mavenLocal()
  }
  
  def tomcatHome = 'E:\\apache-tomcat-7.0.62'
  
  //change the name of war because default it is mywar.1.0.0.war
  war.archiveName "mywar.war"
  
  //move the war into tomcat webapps folder
  task deployToTomcat(type: Copy) {
      from war
      into "$tomcatHome/webapps"
  }
  </code></pre>