title: how to add Jython with a Gradle plugin?
body: <p>How do I use the <a href="https://plugins.gradle.org/plugin/com.github.rzabini.gradle-jython" rel="nofollow noreferrer">Jython plugin</a> to download the dependencies and add them to the classpath with Gradle?</p>
  
  <p>The repositories task has:</p>
  
  <pre><code>maven{url "https://plugins.gradle.org/m2/"}
  </code></pre>
  
  <p>and the dependencies task has:</p>
  
  <pre><code>compile "gradle.plugin.com.github.rzabini:gradle-jython:1.0.2"
  </code></pre>
  
  <p>Does that pull-in Jython itself?  I don't see that it does, because after deleting <code>~/gradle/cache/</code> gradle redownloads the plugin but I don't see JAR's:</p>
  
  <pre><code>thufir@doge:~/NetBeansProjects/nfl$ 
  thufir@doge:~/NetBeansProjects/nfl$ gradle clean run
  :clean UP-TO-DATE
  :compileJava
  Download https://plugins.gradle.org/m2/gradle/plugin/com/github/rzabini/gradle-jython/1.0.2/gradle-jython-1.0.2.pom
  Download https://plugins.gradle.org/m2/de/undercouch/gradle-download-task/2.0.0/gradle-download-task-2.0.0.pom
  Download https://plugins.gradle.org/m2/gradle/plugin/com/github/rzabini/gradle-jython/1.0.2/gradle-jython-1.0.2.jar
  Download https://plugins.gradle.org/m2/de/undercouch/gradle-download-task/2.0.0/gradle-download-task-2.0.0.jar
  :processResources UP-TO-DATE
  :classes
  :runJan 16, 2017 5:25:17 AM net.bounceme.dur.nfl.Run main
  INFO: hello nfl
  Jan 16, 2017 5:25:17 AM net.bounceme.dur.nfl.Run init
  INFO: will now invoke jython
  Jan 16, 2017 5:25:17 AM net.bounceme.dur.nfl.JythonBean &lt;init&gt;
  INFO: java bean for now..
  Jan 16, 2017 5:25:17 AM net.bounceme.dur.nfl.JythonBean createInterpreter
  INFO: jython to follow
  
  
  BUILD SUCCESSFUL
  
  Total time: 6.412 secs
  thufir@doge:~/NetBeansProjects/nfl$ 
  </code></pre>
  
  <p>However, cannot instantiate a <a href="https://bytes.com/topic/python/answers/22390-executing-jython-function-java" rel="nofollow noreferrer">Jython Interpreter</a> after adding that line:</p>
  
  <pre><code>thufir@doge:~/NetBeansProjects/nfl$ 
  thufir@doge:~/NetBeansProjects/nfl$ gradle run
  :compileJava/home/thufir/NetBeansProjects/nfl/src/main/java/net/bounceme/dur/nfl/JythonBean.java:15: error: package org.python.util does not exist
          org.python.util.PythonInterpreter interp = new org.python.util.PythonInterpreter();
                         ^
  /home/thufir/NetBeansProjects/nfl/src/main/java/net/bounceme/dur/nfl/JythonBean.java:15: error: package org.python.util does not exist
          org.python.util.PythonInterpreter interp = new org.python.util.PythonInterpreter();
                                                                        ^
  2 errors
   FAILED
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':compileJava'.
  &gt; Compilation failed; see the compiler error output for details.
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
  
  BUILD FAILED
  
  Total time: 2.816 secs
  thufir@doge:~/NetBeansProjects/nfl$ 
  thufir@doge:~/NetBeansProjects/nfl$ 
  </code></pre>
  
  <p>code:</p>
  
  <pre><code>package net.bounceme.dur.nfl;
  
  import java.util.logging.Logger;
  
  public class JythonBean {
  
      private static final Logger log = Logger.getLogger(JythonBean.class.getName());
  
      public JythonBean() {
          log.info("java bean for now..");
      }
  
      public void createInterpreter() {
          log.info("jython to follow");
          org.python.util.PythonInterpreter interp = new org.python.util.PythonInterpreter();
          //   interp.execfile("script1.py");
  
      }
  
  }
  </code></pre>
  
  <p>The PythonInterpreter line was commented out for the first gradle run so that it would be successful.  I've also tried this from Netbeans, clean and build, same result.</p>
  
  <p>build file:</p>
  
  <pre><code>apply plugin: 'java'
  apply plugin: 'maven'
  apply plugin: 'application'
  
  String mavenGroupId = 'thufir'
  String mavenVersion = '1.0-SNAPSHOT'
  
  sourceCompatibility = '1.8'
  [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
  
  
  // NetBeans will automatically add "run" and "debug" tasks relying on the
  // "mainClass" property. You may however define the property prior executing
  // tasks by passing a "-PmainClass=&lt;QUALIFIED_CLASS_NAME&gt;" argument.
  //
  // Note however, that you may define your own "run" and "debug" task if you
  // prefer. In this case NetBeans will not add these tasks but you may rely on
  // your own implementation.
  
  
  mainClassName = 'net.bounceme.dur.nfl.Run'
  
  if (!hasProperty('mainClass')) {
      ext.mainClass = 'net.bounceme.dur.nfl.Run'
  }
  
  repositories {
   //   mavenCentral()
      // You may define additional repositories, or even remove "mavenCentral()".
      // Read more about repositories here:
      //   http://www.gradle.org/docs/current/userguide/dependency_management.html#sec:repositories
  maven{
  url "https://plugins.gradle.org/m2/"}
  }
  
  dependencies {
      //TODO: Add dependencies here ...
      //You can read more about how to add dependency here:
      //http://www.gradle.org/docs/current/userguide/dependency_management.html#sec:how_to_declare_your_dependencies
      //testCompile group: 'junit', name: 'junit', version: '4.10'
  //    compile 'com.google.api-client:google-api-client:1.20.0'
  //  classpath "gradle.plugin.com.github.rzabini:gradle-jython:1.0.2"
      compile "gradle.plugin.com.github.rzabini:gradle-jython:1.0.2"
  }
  
  
  
  
  
  
      sourceSets {
          main {
              manifest.srcFile 'AndroidManifest.xml'
           //   java.srcDirs = ['src']
  //            resources.srcDirs = ['src']
    //          aidl.srcDirs = ['src']
      //        renderscript.srcDirs = ['src']
        //      res.srcDirs = ['res']
          //    assets.srcDirs = ['assets']
          }
  </code></pre>