Goal to execute a class in an arbitrary artifact outside of any specific project
--------------------------------------------------------------------------------

                 Key: MEXEC-76
                 URL: http://jira.codehaus.org/browse/MEXEC-76
             Project: Maven 2.x Exec Plugin
          Issue Type: New Feature
          Components: java
            Reporter: Dimitry Voytenko


The idea is to have a goal as part of 'exec" plugin for running Java "main" 
classes similar to exec:java goal but w/o requiring a project (i.e. 
@requiredProject = false). I.e. a goal that could run a main class in an 
arbitrary artifact. 

For instance, one could run Xalan's XSLT command line 
(http://xml.apache.org/xalan-j/commandline.html) like this:

  java -classpath ... org.apache.xalan.xslt.Process -IN foo.xml -XSL foo.xsl 
-OUT foo.out

Instead, the new goal would allow to run:

  mvn exec:java-ext -Dartifact=xalan:xalan:2.7.1 
-DmainClass=org.apache.xalan.xslt.Process "-Dargs=-IN foo.xml -XSL foo.xsl -OUT 
foo.out"

When this command is executed, the Maven will download and install Xalan from 
central repository along with all its dependencies, build a separate 
classloader using artifact/dependency information, find the class (Process) and 
execute it's main method passing in the specified arguments. All these steps 
will be done automatically by Maven and thus will take any issues from a user 
that would otherwise be required (downloading binary distribution and all 
dependencies, building classpath, etc). Essentially this would create a "zero" 
footprint model for executing an arbitrary java main-class - all that is 
necessary here is Maven itself. 

The benefits of this model should be attractive. Besides simplifying 
download/install/execute process, this is also a good code distribution model: 
one could create a library, deploy it to enterprise-wide Maven repository and 
execute it on any number of hosts via SSH w/o any additional actions.

P.S. This model is fairly simple and extensible. All of the Maven pieces are 
already there and used successfully in this plugin and many others. The closest 
example to this would be Groovy's Grape. The same execution there could look 
like:

  groovy.grape.Grape.grab(group:'xalan', module:'xalan', version:'2.7.1')
  org.apache.xalan.xslt.Process.main("-IN", "foo.xml", "-XSL", "foo.xsl", 
"-OUT", "foo.out")

Thus, again the idea seems straightforward and implementation should be fairly 
simple as well. If you think this idea has legs I can volunteer to provide the 
implementation code.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to