
jy-maven-plugin
Another Jython Maven Plugin
Features
The jy-maven-plugin provides a fast and easy way to do rapid prototyping of maven plugins or code short one off tasks in maven using the popular and easy to learn Python programming language.
Requirements
- Java: >1.5
- Uses Jython 2.5.2+ (< Jython3)
Installation
mvn deploy:deploy-file -DpomFile=pom.xml -Dfile=jy-maven-plugin-1.2.jar -Durl=file:///your/local/repository/
Example pom.xml
``` http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.mycompany.app my-app jar 1.0-SNAPSHOT jy-maven-plugin demo http://maven.apache.org jy-maven-plugin jy-maven-plugin 1.2 commons-lang commons-lang 2.6 true true ${java.home}b /some/module/path:/some/other/module/path jythontest2.py mvn_plugin # access the plugin and configuration settings via mvn_plugin global variable mvn_plugin.getLog().info("hi this is a maven info text") print(mvn_plugin.project) print mvn_plugin.project.getName() # print project.get name print mvn_plugin.project.getVersion() print mvn_plugin.project.getBuild().getDirectory() print mvn_plugin.project.getBuild().getOutputDirectory() print mvn_plugin.project.getBuild().getFinalName() print mvn_plugin.options
print mvn_plugin.options["key2"] # Not working in Maven 2!
print mvn_plugin.settings.getLocalRepository() print "Settings:" print(mvn_plugin.settings) print "Dependencies:" for i in mvn_plugin.dependencies: print i for i in mvn_plugin.project.getDependencies(): print(i)
Just need a console? Comment in the following
from org.python.util import InteractiveConsole
console = InteractiveConsole(locals())
console.interact()
from org.apache.commons.lang import StringUtils print(StringUtils.split("This comes from StringUtils")) print "& END" ]]> compile execfile mytest.test testpy 1.0 compile --> ```
What's new
V. 1.2
- Java 1.5 compatibility
- Improved dependency handling
- Using current Jython 2.5.2 < Jython 3
Project Information
The project was created on Dec 20, 2011.
- License: Apache License 2.0
- hg-based source control