Talk:Maven

From APIDesign

(Difference between revisions)
Jump to: navigation, search
(Comment provided by Laszlo Kishalmi - via ArticleComments extension)
Line 107: Line 107:
--[[User:JaroslavTulach|JaroslavTulach]] 08:40, 15 September 2009 (UTC)
--[[User:JaroslavTulach|JaroslavTulach]] 08:40, 15 September 2009 (UTC)
 +
== Laszlo Kishalmi said ... ==
 +
 +
<div class='commentBlock'>
 +
If someone needs a clumsy Ant snipet for the problem, 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)
 +
</div>

Revision as of 20:13, 15 September 2009

Comments on Maven <comments />


Contents

Dimiter Makariev said ...

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)

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 snipet for the problem, 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)

Personal tools
buy