Talk:Maven
From APIDesign
(Comment provided by mkleint - via ArticleComments extension) |
(Comment provided by Eric - via ArticleComments extension) |
||
(15 intermediate revisions not shown.) | |||
Line 44: | Line 44: | ||
--[http://www.sonatype.com/books/maven-book/reference/ mkleint] 07:45, 14 September 2009 (CEST) | --[http://www.sonatype.com/books/maven-book/reference/ mkleint] 07:45, 14 September 2009 (CEST) | ||
+ | </div> | ||
+ | == nick said ... == | ||
+ | |||
+ | <div class='commentBlock'> | ||
+ | What you want to look at is the assembly plugin. While I don't think it will give you a zip file, it will let you pack everything into a JAR and for a executable JAR that can be downloaded. It handles extracting all your dependencies and putting them in place. | ||
+ | |||
+ | Looking for something like this: | ||
+ | <artifactId>maven-assembly-plugin</artifactId> | ||
+ | <configuration> | ||
+ | <descriptorRefs> | ||
+ | <descriptorRef>jar-with-dependencies</descriptorRef> | ||
+ | </descriptorRefs> | ||
+ | .... | ||
+ | |||
+ | Hope this helps! | ||
+ | |||
+ | --nick 15:16, 14 September 2009 (CEST) | ||
+ | </div> | ||
+ | == Chris said ... == | ||
+ | |||
+ | <div class='commentBlock'> | ||
+ | Check out the assembly plugin | ||
+ | |||
+ | --Chris 16:50, 14 September 2009 (CEST) | ||
+ | </div> | ||
+ | == hohonuuli said ... == | ||
+ | |||
+ | <div class='commentBlock'> | ||
+ | Maven does support packaging of compound zips. See http://maven.apache.org/plugins/maven-assembly-plugin/ | ||
+ | |||
+ | --hohonuuli 18:52, 14 September 2009 (CEST) | ||
+ | </div> | ||
+ | == Sgt Garcia said ... == | ||
+ | |||
+ | <div class='commentBlock'> | ||
+ | I am using Maven Assembly Plugin with success to gather everything I to run a Desktop App: Start Script files (.bat, .sh, .jnlp...), Main .jar, Libraries .jars, Config files (.properties)... | ||
+ | |||
+ | --Sgt Garcia 18:57, 14 September 2009 (CEST) | ||
+ | </div> | ||
+ | == zerem said ... == | ||
+ | |||
+ | <div class='commentBlock'> | ||
+ | Hi, had some similar problems back then. I'm using maven for releasing desktop application for 3yrs now. Here r my notes for your suffering ;) | ||
+ | |||
+ | Single zip: http://maven.apache.org/plugins/maven-assembly-plugin (for multipple, keyword is overlay) | ||
+ | |||
+ | Main class: http://maven.apache.org/shared/maven-archiver/examples/classpath.html#Add | ||
+ | |||
+ | Adding dependencies: http://maven.apache.org/plugins/maven-dependency-plugin/copy-dependencies-mojo.html | ||
+ | |||
+ | all within standard plugins... | ||
+ | if u want some more info (ex. pices of pom.xml) post me e-mail... | ||
+ | |||
+ | Don't give up on Maven, its just another way of thinking (a better one actually ;)) | ||
+ | |||
+ | And final word: if u need some special work done, writing your own plugin is commonly faster than searching for solution... damn easy. | ||
+ | |||
+ | --[http://thickset.cz zerem] 19:49, 14 September 2009 (CEST) | ||
+ | </div> | ||
+ | |||
+ | Thank you all for your responses. Based on them I studied the recommended book and [[Maven#It_is_Ready.21_It_is_Just_Different.|modified the pom.xml]]. Thanks a lot. | ||
+ | |||
+ | --[[User:JaroslavTulach|JaroslavTulach]] 08:40, 15 September 2009 (UTC) | ||
+ | == Laszlo Kishalmi said ... == | ||
+ | |||
+ | <div class='commentBlock'> | ||
+ | If someone needs a clumsy Ant snippet for the [[LibrariesAndClassPathBuildProblem]], here it is: | ||
+ | <source lang="xml"> | ||
+ | <copy todir="${dist.dir}/lib" flatten="true"> | ||
+ | <fileset dir="${basedir}/lib" includes="**/*.jar"/> | ||
+ | </copy> | ||
+ | <pathconvert property="main.jar.class-path" dirsep="/" pathsep=" "> | ||
+ | <path><fileset dir="${dist.dir}" includes="lib/*.jar"/></path> | ||
+ | <map from="${dist.dir}/" to=""/> | ||
+ | </pathconvert> | ||
+ | <jar update="true" jarfile="${dist.dir}/main.jar"> | ||
+ | <manifest> | ||
+ | <attribute name="Class-Path" value="${main.jar.class-path}"/> | ||
+ | </manifest> | ||
+ | </jar> | ||
+ | </source> | ||
+ | |||
+ | --Laszlo Kishalmi 22:13, 15 September 2009 (CEST) | ||
+ | |||
+ | Thanks Laszlo, I am creating a [[LibrariesAndClassPathBuildProblem|separate page]] with your code! | ||
+ | |||
+ | --[[User:JaroslavTulach|JaroslavTulach]] 05:50, 16 September 2009 (UTC) | ||
+ | |||
+ | </div> | ||
+ | == Laszlo Kishalmi said ... == | ||
+ | |||
+ | <div class='commentBlock'> | ||
+ | Thanks Jarda for the proper formatting! | ||
+ | |||
+ | --Laszlo Kishalmi 08:34, 16 September 2009 (CEST) | ||
+ | </div> | ||
+ | == NicolasDumoulin said ... == | ||
+ | |||
+ | <div class='commentBlock'> | ||
+ | Yes the basic maven documentation is not a good start, and the sonatype book is very helpfull to understand how it works. In the other hand, when you'll have understand the basics, the plugins documentation is very efficient: | ||
+ | http://maven.apache.org/plugins/ | ||
+ | |||
+ | And, with the book, a very good way is to read pom.xml of good projects to learn how they do. | ||
+ | |||
+ | And yes, NetBeans is very good tool for working with maven projects :-) | ||
+ | |||
+ | --NicolasDumoulin 11:04, 14 October 2009 (CEST) | ||
+ | </div> | ||
+ | == Claudiu said ... == | ||
+ | |||
+ | <div class='commentBlock'> | ||
+ | Your all-zip.xml needs to be rectified at source end tag. | ||
+ | |||
+ | --Claudiu 00:40, 15 February 2010 (CET) | ||
+ | </div> | ||
+ | == Alexander K said ... == | ||
+ | |||
+ | <div class='commentBlock'> | ||
+ | And the link to "The Maven Definitive Guide" doesn't seem to work at all. | ||
+ | |||
+ | --Alexander K 23:08, 27 September 2013 (CEST) | ||
+ | </div> | ||
+ | |||
+ | I googled for ''site:sonatype.com maven definitive guide'' and updated the link. | ||
+ | |||
+ | --[[User:JaroslavTulach|JaroslavTulach]] 11:11, 29 September 2013 (UTC) | ||
+ | == Eric said ... == | ||
+ | |||
+ | <div class='commentBlock'> | ||
+ | How very timely! I was just thkniing about this last night and started the ever-difficult climb back into the workout wagon this morning. I started running seriously over the summer and ran a half marathon in September but had only run once or twice since! I loved how running and working out made me feel, physically and mentally it just boosts all sorts of good feelings. Why wouldn't I want to continue that? Well, it started off innocently enough, as falling out of the wagon usually does I took some days off post-race to recuperate. Then I got sick. Then I got so overwhelmingly busy that I felt like working out would be a Waste of Time and that I could be doing more productive things. Now, how on earth can I expect to be at my best and be giving my all if I don't take care of myself?I'm getting back into working out and running dammit. It's happening. And it will be Glorious. | ||
+ | |||
+ | --Eric 10:02, 21 October 2013 (CEST) | ||
</div> | </div> |
Current revision
Comments on Maven <comments />
Dimiter Makariev said ...
Anuradha said ...
did you try out Maven Assembly Plugin
http://maven.apache.org/plugins/maven-assembly-plugin/
--Anuradha 04:43, 14 September 2009 (CEST)
btilford said ...
You probably want to look at maven assemblies and the maven book. http://www.sonatype.com/books/maven-book/reference/assemblies.html
--btilford 05:35, 14 September 2009 (CEST)
mkleint said ...
your time would probably be better spent by reading the Maven book to learn about Maven than writing this blog entry..
--mkleint 07:45, 14 September 2009 (CEST)
nick said ...
What you want to look at is the assembly plugin. While I don't think it will give you a zip file, it will let you pack everything into a JAR and for a executable JAR that can be downloaded. It handles extracting all your dependencies and putting them in place.
Looking for something like this: <artifactId>maven-assembly-plugin</artifactId>
<configuration> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs>
....
Hope this helps!
--nick 15:16, 14 September 2009 (CEST)
Chris said ...
Check out the assembly plugin
--Chris 16:50, 14 September 2009 (CEST)
hohonuuli said ...
Maven does support packaging of compound zips. See http://maven.apache.org/plugins/maven-assembly-plugin/
--hohonuuli 18:52, 14 September 2009 (CEST)
Sgt Garcia said ...
I am using Maven Assembly Plugin with success to gather everything I to run a Desktop App: Start Script files (.bat, .sh, .jnlp...), Main .jar, Libraries .jars, Config files (.properties)...
--Sgt Garcia 18:57, 14 September 2009 (CEST)
zerem said ...
Hi, had some similar problems back then. I'm using maven for releasing desktop application for 3yrs now. Here r my notes for your suffering ;)
Single zip: http://maven.apache.org/plugins/maven-assembly-plugin (for multipple, keyword is overlay)
Main class: http://maven.apache.org/shared/maven-archiver/examples/classpath.html#Add
Adding dependencies: http://maven.apache.org/plugins/maven-dependency-plugin/copy-dependencies-mojo.html
all within standard plugins... if u want some more info (ex. pices of pom.xml) post me e-mail...
Don't give up on Maven, its just another way of thinking (a better one actually ;))
And final word: if u need some special work done, writing your own plugin is commonly faster than searching for solution... damn easy.
--zerem 19:49, 14 September 2009 (CEST)
Thank you all for your responses. Based on them I studied the recommended book and modified the pom.xml. Thanks a lot.
--JaroslavTulach 08:40, 15 September 2009 (UTC)
Laszlo Kishalmi said ...
If someone needs a clumsy Ant snippet for the LibrariesAndClassPathBuildProblem, here it is:
<copy todir="${dist.dir}/lib" flatten="true"> <fileset dir="${basedir}/lib" includes="**/*.jar"/> </copy> <pathconvert property="main.jar.class-path" dirsep="/" pathsep=" "> <path><fileset dir="${dist.dir}" includes="lib/*.jar"/></path> <map from="${dist.dir}/" to=""/> </pathconvert> <jar update="true" jarfile="${dist.dir}/main.jar"> <manifest> <attribute name="Class-Path" value="${main.jar.class-path}"/> </manifest> </jar>
--Laszlo Kishalmi 22:13, 15 September 2009 (CEST)
Thanks Laszlo, I am creating a separate page with your code!
--JaroslavTulach 05:50, 16 September 2009 (UTC)
Laszlo Kishalmi said ...
Thanks Jarda for the proper formatting!
--Laszlo Kishalmi 08:34, 16 September 2009 (CEST)
NicolasDumoulin said ...
Yes the basic maven documentation is not a good start, and the sonatype book is very helpfull to understand how it works. In the other hand, when you'll have understand the basics, the plugins documentation is very efficient: http://maven.apache.org/plugins/
And, with the book, a very good way is to read pom.xml of good projects to learn how they do.
And yes, NetBeans is very good tool for working with maven projects :-)
--NicolasDumoulin 11:04, 14 October 2009 (CEST)
Claudiu said ...
Your all-zip.xml needs to be rectified at source end tag.
--Claudiu 00:40, 15 February 2010 (CET)
Alexander K said ...
And the link to "The Maven Definitive Guide" doesn't seem to work at all.
--Alexander K 23:08, 27 September 2013 (CEST)
I googled for site:sonatype.com maven definitive guide and updated the link.
--JaroslavTulach 11:11, 29 September 2013 (UTC)
Eric said ...
How very timely! I was just thkniing about this last night and started the ever-difficult climb back into the workout wagon this morning. I started running seriously over the summer and ran a half marathon in September but had only run once or twice since! I loved how running and working out made me feel, physically and mentally it just boosts all sorts of good feelings. Why wouldn't I want to continue that? Well, it started off innocently enough, as falling out of the wagon usually does I took some days off post-race to recuperate. Then I got sick. Then I got so overwhelmingly busy that I felt like working out would be a Waste of Time and that I could be doing more productive things. Now, how on earth can I expect to be at my best and be giving my all if I don't take care of myself?I'm getting back into working out and running dammit. It's happening. And it will be Glorious.
--Eric 10:02, 21 October 2013 (CEST)
Hi, probably a good idea is to try the maven assembly plugin : http://maven.apache.org/plugins/maven-assembly-plugin/features.html also take a look at : http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html Better Builds with Maven is great book : http://www.maestrodev.com/better-build-maven and last but not least : you can always go back to ant with the Maven ant plugin : http://maven.apache.org/plugins/maven-antrun-plugin/
I'm coming from the web development world .. so for a pity I cannot comment on the question about is maven ready for java desktop applications.
Wish you luck with Maven :)
--Dimiter Makariev 02:13, 14 September 2009 (CEST)