title: Why the gradle war task is skipped?
body: <p>I am a new convert to Gradle. Most of the tasks work fine. However, I see that the war task is always skipped. When I run in the debug mode, I see the following logs -</p>
  <pre class="lang-none prettyprint-override"><code>09:12:34.889 [LIFECYCLE] [class
  org.gradle.internal.buildevents.TaskExecutionLogger] :war 09:12:34.889
  [DEBUG]
  [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter]
  Starting to execute task ':war' 09:12:34.889 [INFO]
  **[org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter] Skipping task ':war' as task onlyIf is false.** 09:12:34.889 [DEBUG]
  [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter]
  Finished executing task ':war' 09:12:34.889 [LIFECYCLE] [class
  org.gradle.internal.buildevents.TaskExecutionLogger] :war SKIPPED
  </code></pre>
  <p>I am not sure why <code>onlyIf</code> is false. I did search on internet. But I did not find anything related.</p>
  <p>Here is my Gradle file -</p>
  <pre class="lang-groovy prettyprint-override"><code>buildscript {
    ext {
      springBootVersion = '2.0.0.M2'
    }
    repositories {
      mavenCentral()
      maven { url &quot;https://repo.spring.io/snapshot&quot; }
      maven { url &quot;https://repo.spring.io/milestone&quot; }
    }
    dependencies {
      classpath(&quot;org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}&quot;)
    }
  }
  
  // Apply the java-library plugin to add support for Java Library
  apply plugin: 'java-library'
  apply plugin: 'eclipse'
  apply plugin: 'org.springframework.boot'
  apply plugin: 'io.spring.dependency-management'
  apply plugin: 'war'
  apply plugin: 'checkstyle'
  apply plugin: 'pmd'
  apply plugin: 'findbugs'
  apply plugin: 'jacoco'
  
  version = '0.0.1-SNAPSHOT'
  sourceCompatibility = 1.8
  
  repositories {
      jcenter()
    mavenCentral()
    maven { url &quot;https://repo.spring.io/snapshot&quot; }
    maven { url &quot;https://repo.spring.io/milestone&quot; }
  }
  
  dependencies {
  
    compile('org.springframework.boot:spring-boot-starter')
    compile(&quot;org.springframework.boot:spring-boot-starter-web&quot;)
    compile(&quot;org.springframework.retry:spring-retry:1.2.1.RELEASE&quot;)
  
    compile(&quot;org.springframework.data:spring-data-cassandra:2.0.0.M4&quot;)
  
    compile(&quot;io.reactivex.rxjava2:rxjava:2.1.1&quot;)
  
    //compile(&quot;javax.persistence:persistence-api:1.0.2&quot;)
    //compile(&quot;org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.1.Final&quot;)
    compile(&quot;org.springframework.boot:spring-boot-starter-data-jpa&quot;)
    compile(&quot;com.zaxxer:HikariCP:2.6.0&quot;)
  
    // Test Dependencies
    testCompile(&quot;org.springframework.boot:spring-boot-starter-test&quot;)
    testCompile(&quot;org.powermock:powermock-mockito-release-full:1.6.4&quot;)
    testCompile(&quot;org.mockito:mockito-core:2.0.3-beta&quot;)
    testCompile(&quot;org.cassandraunit:cassandra-unit:3.1.3.2&quot;)
    testCompile(&quot;org.cassandraunit:cassandra-unit-spring:2.2.2.1&quot;)
    testCompile(&quot;com.h2database:h2:1.4.196&quot;)
  
      // This dependency is exported to consumers, that is to say found on their compile classpath.
      api 'org.apache.commons:commons-math3:3.6.1'
  
      // This dependency is used internally, and not exposed to consumers on their own compile classpath.
      implementation 'com.google.guava:guava:21.0'
  
      testImplementation 'junit:junit:4.12'
  }
  </code></pre>
  <p>Here is the image of my project structure -</p>
  <p><a href="https://i.stack.imgur.com/mNn3u.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mNn3u.png" alt="enter image description here" /></a></p>
  <p>If you could help me with generating the war file that would be great.</p>