title: How to setup Hibernate Gradle plugin in kotlin-script?
body: <p>I am trying to setup the <strong>Hibernate gradle plugin</strong> in my Gradle Kotlin-script project, to no avail.</p>
  
  <p>I followed the answers <a href="https://stackoverflow.com/a/56442509/2041863">here</a> and <a href="https://stackoverflow.com/a/35581674/2041863">here</a>, my configuration is as follows:</p>
  
  <p><strong>settings.gradle.kts:</strong></p>
  
  <pre><code>pluginManagement {
      resolutionStrategy {
          eachPlugin {
              if (requested.id.id == "org.hibernate.orm") {
                  useModule("org.hibernate:hibernate-gradle-plugin:${requested.version}")
              }
          }
      }
  }
  </code></pre>
  
  <p><strong>build.gradle.kts</strong></p>
  
  <pre><code>plugins {
    ...
    id("org.hibernate.orm") version "5.4.9.Final"
    ...
  }
  
  ...
  
  hibernate {
    enhance {  }
  }
  </code></pre>
  
  <p>I am getting an error from Gradle:</p>
  
  <pre><code>  Line 193:   enhance {}
                        ^ Type mismatch: inferred type is () -&gt; Unit but (Closure&lt;Any!&gt;..Closure&lt;*&gt;?) was expected
  </code></pre>
  
  <p>I also tried with the following <code>hibernate</code> block:</p>
  
  <pre><code>hibernate {
    enhance {
      enableLazyInitialization = true
      enableDirtyTracking = true
      enableAssociationManagement = true
    }
  }
  </code></pre>
  
  <p>but i'm just getting more errors:</p>
  
  <pre><code>  Line 193:   enhance {
                        ^ Type mismatch: inferred type is () -&gt; Unit but (Closure&lt;Any!&gt;..Closure&lt;*&gt;?) was expected
  
    Line 194:     enableLazyInitialization = true
                  ^ Unresolved reference: enableLazyInitialization
  
    Line 195:     enableDirtyTracking = true
                  ^ Unresolved reference: enableDirtyTracking
  
    Line 196:     enableAssociationManagement = true
                  ^ Unresolved reference: enableAssociationManagement
  </code></pre>
  
  <p>Anyone knows how to make this work in Kotlin-script?</p>