title: Gradle's publishToMavenLocal task is not executed correctly
body: <p>I'm trying to create a gradle based multi-module project. There is also an project that contains different gradle scripts that enables pluggable build configurations. One of those scripts is for publishing artifacts to maven repository. This is the content of that script:</p>
  
  <pre><code>apply plugin: 'maven-publish'
  
  configure(subprojects.findAll()) {
      if (it.name.endsWith('web')) {
          publishing {
              publications {
                  mavenWeb(MavenPublication) {
                      from components.web
                  }
              }
          }
      } else {
          publishing {
              publications {
                  mavenJava(MavenPublication) {
                      from components.java
                  }
              }
          }
      }
  }
  
  build.dependsOn publishToMavenLocal
  </code></pre>
  
  <p>This script is included in the build gradle file of other project.</p>
  
  <pre><code>apply from: '../../food-orders-online-main/artifact-publish.gradle'
  </code></pre>
  
  <p>When I run build task it always shows that publishToMavenLocal task is up to date and I cannot find the artifacts in the local repository. Am I doing something wrong?</p>