Gradle Jython Plugin Not Working?

Hi all,

I’m trying to use this Jython plugin in my project, but it does not seem to be working.

And yes, I have seen this post. I post this because that was not the same plugin.

It seems to me as though this plugin allows me to embed Python into Java. Here is my build.gradle:

plugins {
    id 'com.github.hierynomus.jython' version '0.6.0'
    id 'java'
    id 'maven'
    id 'application'
}

mainClassName = 'zumi.HelloWorld'

repositories {
    mavenCentral()
}

jar {
    archiveBaseName = 'zumi-gradle'
    archiveVersion = '0.1.0'
}

I am trying to import org.python.utils, but it is responding with this when I try to build it:

C:\Users\Ben Bistline\Documents\Zumi Research\Deploy\Code>gradlew run

> Task :compileJava FAILED
C:\Users\Ben Bistline\Documents\Zumi Research\Deploy\Code\src\main\java\zumi\HelloWorld.java:3: error: package org.python.util does not exist
import org.python.util.*;
^
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> 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. Run with --scan to get full insights.   

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 1s
1 actionable task: 1 executed

Alternatively, I have a Jython JAR file, but I get the same error when I try to set that file as a dependency.

Any help is appreciated. Thanks!

From a quick look at the description of the plugin and its code, it only downloads Python libraries for you and cares for those downloaded libraries to be packaged in your JAR.

I was able to solve my problem. I am making use of this library.