Awesome
Description
Mop is a small utility for executing Java programs which are stored as artifacts like jars or bundles in a Maven repository.
Mop automatically deals with the following for you
- transitive dependencies
- downloading artifacts from remote repositories and caching them locally
- building the application classpath
Synopsis
Currently supported generic commands:
mop classpath
: displays the classpath for the artifactmop copy
: copies all the jars into the given directorymop echo
: displays the command line to set the classpath and run the class's main() methodmop exec
: spawns a separate process to run the class's main() method in a new JVMmop execjar
: spawns a separate process to run the Main class from the executable jar in a new JVMmop fork
: Forks a new child JVM and executes the remaining arguments as a child Mop processmop install
: Installs the given artifacts in the given target directorymop jar
: uses an embedded class loader to run the Main class from the executable jarmop run
: uses an embedded class loader to run the class's main() methodmop shell
: Forks a new child process by running an external command
Command extensions:
mop broker
: Starts an Apache ActiveMQ broker along with the web console. You can use broker:version to specify the ActiveMQ versionmop camel-example-pojo
: Runs the Apache Camel POJO Messaging Example. For more see: http://camel.apache.org/pojo-messaging-example.htmlmop cloudmixAgent
: Starts a CloudMix agentmop guice
: Runs the given artifact(s) by starting a Guice injector and injecting all of the given modules listed on the command linemop karaf
: Starts an embedded Karaf container and deploys the given artifact(s) inside itmop servicemix
:mop spring
: Runs the given artifact(s) by starting the XML application context specified as an argument or defaults to META-INF/spring/*.xmlmop war
: runs the given (typically war) archetypes in the jetty servlet engine via jetty-runner
Examples
Need to build a script file to start your java application and you having a hard time setting up a class path that contains all the dependencies? Mop can help. Just capture the result of the mop classpath
command in the CLASSPATH
variable:
$ CLASSPATH=`mop classpath commons-logging:commons-logging:1.1`
$ echo $CLASSPATH
/opt/mop/repository/commons-logging/commons-logging/1.1/commons-logging-1.1.jar
:/opt/mop/repository/log4j/log4j/1.2.12/log4j-1.2.12.jar:/opt/mop/repository/lo
gkit/logkit/1.0.1/logkit-1.0.1.jar:/opt/mop/repository/avalon-framework/avalon-
framework/4.1.3/avalon-framework-4.1.3.jar:/opt/mop/repository/javax/servlet/se
rvlet-api/2.3/servlet-api-2.3.jar
The following example will boot up one of the Apache Camel example programs
mop run org.apache.camel:camel-example-pojo-messaging org.apache.camel.spring.Main
The mop run
command takes a maven artifact name then a Java class name along with optional command line arguments. The maven artifact uses the following format
[groupId:]artifactId[[:type[:classifier]]:version]
Note that that you can omit the group id, type, classifier and version. You typically may supply just groupId, artifactId, version if you like - or if you really need to specify type (jar/war etc) and classifier if needed.
Project Links
- Project Home
- Release Downloads
- GitHub
- Source:
git clone git://forge.fusesource.com/mop.git