Search the web
Sign In
New User? Sign Up
novajug · Northern Virginia Java Users Group (NOVA
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
How to Run A Jar in Maven?   Message List  
Reply | Forward Message #13410 of 13717 |
Re: [novajug] How to Run A Jar in Maven?

Keith,

I'm not sure what you are trying to do here... do you want maven to
*launch* your script, or are you trying to use Maven to *assemble*
everything necessary to launch it?

Maven would let you build a runnable jar file from all the pieces, so
you could then do something like:

java -jar keiths-project-1.0-snapshot.jar

but maven isn't about launching your project after you've written it
(unless you are using something like the cargo plugin in order to do
deploys).

If you want a jruby script to run *as part of your build process* (the
way, for example, the i18n stuff used to work on the project we worked
on together), then you need to write a maven plugin and bind it to a
lifecycle phase of the build. This isn't as hard as it sounds - I do
it in an intermediate maven presentation I have, and could show it to
you in ~10 minutes.

-db




On Tue, Jun 30, 2009 at 12:05 AM, David
Medinets<david.medinets@...> wrote:
>
>
> On Mon, Jun 29, 2009 at 10:48 PM, Keith R.
> Bennett<keithrbennett@...> wrote:
>> Is there an incantation of Maven that is used to run a Jar file?
>> Should I use the ant plugin?
>
> I'd use the Ant plugin. I worked with Maven perhaps a year ago and it
> took a whole shift in thinking for me to use it well. I don't have the
> mode of thinking anymore but I do remember that the Ant plugin worked
> well to bridge the 'generate it' and the 'run it' worlds.
>
>



Fri Jul 3, 2009 9:39 pm

javaguy_98
Offline Offline
Send Email Send Email

Forward
Message #13410 of 13717 |
Expand Messages Author Sort by Date

All - I am struggling with Maven and could really use some help. My need seems simple, and the solution may well be simple too, but it evades me. I need to...
Keith R. Bennett
krbennettmd
Offline Send Email
Jun 30, 2009
2:49 am

On Mon, Jun 29, 2009 at 10:48 PM, Keith R. ... I'd use the Ant plugin. I worked with Maven perhaps a year ago and it took a whole shift in thinking for me to...
David Medinets
medined
Offline Send Email
Jun 30, 2009
4:06 am

Keith, I'm not sure what you are trying to do here... do you want maven to *launch* your script, or are you trying to use Maven to *assemble* everything...
David Bock
javaguy_98
Offline Send Email
Jul 3, 2009
9:41 pm

Dave - Thanks for offering to help. I'd like to create a pom file such that the user would would only need Maven, that pom file, and my JRuby script to run a...
Keith R. Bennett
krbennettmd
Offline Send Email
Jul 5, 2009
10:27 pm

What you are suggesting is against "The Maven Way". Maven wants to build one and exactly one artifact per project, so building your jar file along with a .sh...
David Bock
javaguy_98
Offline Send Email
Jul 11, 2009
7:06 pm

Dave - I don't want to build a jar file, and I don't want to override any jar locations. Quite the contrary, one of the main reasons I want to use Maven is to...
Keith Bennett
krbennettmd
Offline Send Email
Jul 13, 2009
1:03 am

I believe that the only user defined argument mavan accepts is a list of profiles to be activated. Maven does all those things (dependencies, downloading,...
Ramanand Singh
sramanand
Online Now Send Email
Jul 13, 2009
4:01 pm

Maven just isn't designed to do this. Maven isn't about anything happening with your app at runtime, just build time. Maven accepts a 'goal' as a command...
David Bock
javaguy_98
Offline Send Email
Jul 13, 2009
6:10 pm

There is an "exec-maven-plugin" that lets you run java programs from a maven command. We use it to run groovy programs from maven. Another option is to write a...
clay_shooter
Offline Send Email
Jul 14, 2009
12:05 pm

I got a response from Nick Sieger, one of the JRuby developers, at: http://www.nabble.com/Running-a-JRuby-Script-With-Maven-to24261672.html#\ a24455806 - or - ...
Keith R. Bennett
krbennettmd
Offline Send Email
Jul 14, 2009
9:51 pm

Dude, try the shade plugin to build an uber-jar (like one-jar) and maybe go from there. http://maven.apache.org/plugins/maven-shade-plugin/ ...
joeweder
Offline Send Email
Jul 15, 2009
12:45 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help