Using Jython with Maven

I have a Maven module that depends on various other Maven dependencies through which I look through my jython code.

Now I am ready, and I would like to compile the project as .jar or even just run it without compiling, but I do not know where to start.

Does anyone know how I can run some .py files that access some Java libraries in other packages?

Also, how can I compile it as a .jar file when everything is done and good?

Thank!

+13
maven-2 jython
Sep 07 2018-10-10T00:
source share
4 answers

I somehow understood my answer to this question. I shouldn't have tried to compile it, but instead porting python code using Java: http://jythonpodcast.hostjava.net/jythonbook/en/1.0/JythonAndJavaIntegration.html#using-jython-within-java-applications

+1
Sep 08 '10 at 8:45
source share
โ€” -

Python compilation and integration

Use jython-compile-maven-plugin. It allows you to deploy a stand-alone project including jython with libraries.

To demonstrate this plugin, see the demo project and its source code . He shows how

  • run the python console . See AbstractInitJython and InitJython on how to run the python / jython console, how to execute python code snippets, and how to run a python script.

  • include python libraries . The plugin also downloads and links python libraries (using easy_install) in the package phase and adds them to the jar. The resulting jar can have all the project libraries, all pom dependencies, and all python libraries. The demo project shows this using the python nose-library (see pom file).

Testing python / jython code

The python-test-maven plugin allows you to run Python tests along with regular junit tests. The demo project (look at the source in the source code ) shows the use of standard tests on the python module (with the nose) and BDD (behavior testing) using the salad clone is refreshing.




Sourceforge probe project http://mavenjython.sourceforge.net/

Unlike maven-jython-plugin, they do not use the obsolete jythonc compiler.

+12
Aug 16 '11 at 12:27
source share

Now I have done, and I would like to compile the project as .jar,

There seems to be a maven-jython-plugin that allows you to compile jython source files into Java class files.

+2
Sep 07 '10 at 16:13
source share

The jython compiler part, jythonc, has been deprecated since 2.5 - http://wiki.python.org/jython/ReplaceJythonc - the replacement is in progress.

+1
Jun 03 2018-11-11T00:
source share



All Articles