title: Using Gradle to build a JAR with dependencies
body: <p>I have a multiproject build and I put a task to build a fat JAR in one of the subprojects. I created the task similar to the one <a href="http://docs.codehaus.org/display/GRADLE/Cookbook#Cookbook-Creatingafatjar" rel="nofollow noreferrer">described in this cookbook</a>.</p>
  <pre><code>jar {
    from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
    manifest { attributes 'Main-Class': 'com.benmccann.gradle.test.WebServer' }
  }
  </code></pre>
  <p>Running it results in the following error:</p>
  <blockquote>
  <p>Cause: You can't change a
  configuration which is not in
  unresolved state!</p>
  </blockquote>
  <p>I'm not sure what this error means. <a href="http://jira.codehaus.org/browse/GRADLE-1361" rel="nofollow noreferrer">I also reported this on the Gradle JIRA in case it is a bug</a>.</p>