Why gradle jars are written in `build/libs`? : <p>According to the <a href="https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html" rel="noreferrer">documentation of the Jar plugin</a>, the output directory is controlled by the <code>destinationDir</code> property:</p>

<blockquote>
  <ul>
  <li><p><strong>File</strong> <code>destinationDir</code></p>
  
  <p>The directory where the archive is generated into.</p>
  
  <p>Default with java plugin: <code>project.distsDir</code></p></li>
  </ul>
</blockquote>

<p>Looking at the <a href="https://docs.gradle.org/current/dsl/org.gradle.api.Project.html" rel="noreferrer">documentation of the Project class</a> the same property is mentioned:</p>

<blockquote>
  <p><strong>Properties added by the <code>java</code> plugin</strong></p>
  
  <ul>
  <li><code>distsDir</code>: The directory to generate TAR and ZIP archives into.</li>
  <li><code>distsDirName</code>: The name for the distributions directory. This in interpreted relative to the project' build directory.</li>
  </ul>
</blockquote>

<p>And Googling a bit I find <a href="https://docs.gradle.org/current/dsl/org.gradle.api.plugins.BasePluginConvention.html#org.gradle.api.plugins.BasePluginConvention:distsDirName" rel="noreferrer">a document specifying their defaults</a>:</p>

<blockquote>
  <ul>
  <li><p><strong>File</strong> <code>distsDir</code> (read-only)</p>
  
  <p>The directory to generate TAR and ZIP archives into.</p>
  
  <p>Default with java plugin: <code>${project.buildDir}/${project.distsDirName}</code></p></li>
  <li><p><strong>String</strong> <code>distsDirName</code></p>
  
  <p>The name for the distributions directory. This in interpreted relative
  to the project' build directory.</p>
  
  <p>Default with java plugin: <code>'distributions'</code></p></li>
  </ul>
</blockquote>

<p>All these documents point to the same Gradle version, that matches the one I have installed.</p>

<p>I add this in my <code>build.gradle</code> to check the real values of these properties:</p>

<pre><code>println("distsDirName = " + project.distsDirName)
println("distsDir = " + project.distsDir.toString())

jar {
    println("jar.destinationDir = " + destinationDir)
}
</code></pre>

<p>And finally, I run <code>./gradlew</code> and check the output:</p>

<pre><code>distsDirName = distributions
distsDir = /home/ntrrgc/myProject/build/distributions
jar.destinationDir = /home/ntrrgc/myProject/build/libs
</code></pre>

<p>Why does <code>jar.destinationDir</code> not respect its documented default?</p>
