I added the maven-assembly-plugin as described here: http://stackoverflow.com/questions/574594/how-can-i-create-an-executable-jar-with-dependencies-using-mavenand now the dependencies are bundled within the jar. Thanks for your help - much to learn, but I'm learning quite a bit about Maven.
On Thu, Feb 6, 2014 at 11:28 AM, Jarlath Reidy <[email protected]>wrote: > Cancel that. It does exist. And more importantly it exists in the > target/lib folder. > > > On Thu, Feb 6, 2014 at 11:11 AM, Jarlath Reidy <[email protected]>wrote: > >> I have just noticed that the dependency it complains about does not exist >> in my .m2 folder. I don't know how Eclipse is executing this project but I >> would have expected mvn package to pull in that dependency to the local >> repository. >> >> >> On Thu, Feb 6, 2014 at 10:02 AM, Jarlath Reidy <[email protected]>wrote: >> >>> "You should specify the fully qualified main class eg: >>> com.mycompany.app.App >>> in the mainClass field/parameter to the plugin." >>> "1. the main-class-name was supposed to be your main class" >>> Let me clarify. The entry appears in the manifest as: >>> mainClass: fully.qualified.path.to.MyApp >>> instead of >>> Main-Class: fully.qualified.path.to.MyApp >>> >>> I've changed it in the pom (I thought that the tag was a fixed keyword >>> so I didn't change it there initially). >>> >>> >>> "The classpathPrefix line sets where to look for additional JAR files. It >>> is relative to where you are." >>> So relative to where I execute my java -jar ... command from. Okay, I >>> have that. I'm executing from the directory above (..) the target. >>> >>> >>> "Maven compiles and packages your program into a JAR. It copies all of >>> the supporting JAR files listed in your dependencies into target/lib. >>> Before you run, make sure that target/lib exists and has all of the JAR >>> files you need." >>> Yep, they're all there. Including the jar which contains the class it >>> says it can't load and I can see that that class is present in the jar. >>> >>> >>> "The exec plugin (http://mojo.codehaus.org/exec-maven-plugin/) as Wayne >>> has mentioned is another way to accomplish this. This will help you run >>> from within an IDE or by using mvn exec:exec, but it won't help you >>> package and ship your code out for other users." >>> Once I get this running from the command line, this will be an option >>> that I want to use. I'm still getting ClassNotFoundException though. I'm >>> guessing that since I _can_ see the dependencies that this line must be the >>> culprit: >>> "<classpathPrefix>target/</classpathPrefix>" >>> I'm going to try target/lib now. >>> >>> This is a sample client so packaging isn't too important at this point. >>> Good to know, thank you. >>> >>> >>> On Wed, Feb 5, 2014 at 10:17 PM, Wayne Fay [via Maven] < >>> [email protected]> wrote: >>> >>>> > *Failed to load Main-Class manifest attribute from target/myApp.jar* >>>> > >>>> > I opened the manifest and the *Main-Class* attribute was entered as >>>> > *mainClass.* So I changed it to the former and that got rid of that >>>> error. >>>> > But now I *still *get the original error. >>>> >>>> You should specify the fully qualified main class eg: >>>> com.mycompany.app.App >>>> in the mainClass field/parameter to the plugin. >>>> >>>> Wayne >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [hidden >>>> email]<http://user/SendEmail.jtp?type=node&node=5783328&i=0> >>>> For additional commands, e-mail: [hidden >>>> email]<http://user/SendEmail.jtp?type=node&node=5783328&i=1> >>>> >>>> >>>> >>>> ------------------------------ >>>> If you reply to this email, your message will be added to the >>>> discussion below: >>>> >>>> http://maven.40175.n5.nabble.com/Build-is-successful-but-can-t-run-tp5783294p5783328.html >>>> To unsubscribe from Build is successful but can't run?, click >>>> here<http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5783294&code=amFybGF0aHJlaWR5QGdtYWlsLmNvbXw1NzgzMjk0fDEyMDg3OTQ0MDQ=> >>>> . >>>> NAML<http://maven.40175.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> >>>> >>> >>> >> > -- View this message in context: http://maven.40175.n5.nabble.com/Build-is-successful-but-can-t-run-tp5783294p5783372.html Sent from the Maven - Users mailing list archive at Nabble.com.
