Grokbase Groups Maven users May 2003
FAQ
A couple of questions for y'all:

How do I specify that the .jar file for my project be deployed to target/lib?

How do I specify (hopefully w/in a dependency) that the jar should be copied
to target/lib?

Thanks,

Matt



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org

Search Discussions

  • Joe Germuska at May 29, 2003 at 10:38 pm

    At 3:19 PM -0700 5/29/03, Matt Raible wrote:
    A couple of questions for y'all:

    How do I specify that the .jar file for my project be deployed to target/lib?
    you mean that the Jar ends up in "target/lib"? set 'maven.build.dir'
    -- see for more
    http://maven.apache.org/reference/plugins/jar/properties.html

    How do I specify (hopefully w/in a dependency) that the jar should be copied
    to target/lib?
    Don't understand this question. Are you trying to build webapps?
    You may want to see
    http://maven.apache.org/reference/plugins/jar/properties.html


    If you're building some kind of distribution that puts a number of
    Jars in "target/lib" but it's not a War, you could probably copy some
    of the logic from
    $MAVEN_HOME/plugins/maven-war-plugin-1.3/plugin.jelly into a
    "maven.xml" file in your project directory and create a custom goal.
    I can't think of anything offhand which is directly designed for your
    needs, but like I said, I'm not sure if I understand your needs!


    --
    --
    Joe Germuska
    Joe@Germuska.com
    http://blog.germuska.com
    "If nature worked that way, the universe would crash all the time."
    --Jaron Lanier

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
    For additional commands, e-mail: users-help@maven.apache.org
  • Matt Raible at May 29, 2003 at 11:22 pm
    Thanks, both answers where what I was looking for. I'm not building a webapp
    (yet). Currently, I'm copying all jars (including the built one) into
    target/lib, and then running:

    java -cp [all jars] package.className

    Adding the following helped me get my dependent jars into the target/lib
    directory:

    <postGoal name="jar">
    <j:forEach var="dep" items="${pom.dependencies}">
    <j:if test="${dep.getProperty('bundle.jar')=='true'}">
    <copy todir="${maven.build.dir}"
    file="${maven.repo.local}/${dep.artifactDirectory}/jars/
    ${dep.artifact}"/>
    </j:if>
    </j:forEach>
    </postGoal>

    Now, I'm running into a new problem. I have a Resources.properties file in
    my java/src/package... tree, and I want to include it in the jar.

    Unfortunately, this is not working:

    <resources>
    <includes>
    <include>**/*.properties</include>
    </includes>
    </resources>

    Thanks,

    Matt

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
    For additional commands, e-mail: users-help@maven.apache.org
  • Matt Raible at May 30, 2003 at 12:23 am
    In the interest of reporting success, I decided not to change the
    maven.build.dir and instead just move everything to target/lib. I also found
    a simply way to copy dependent jars. Here's my new post goal.

    <postGoal name="jar">
    <!-- Create a target/lib directory -->
    <mkdir dir="${maven.build.dir}/lib"/>

    <!-- Move any generated jars into this directory -->
    <move file="${maven.build.dir}/${maven.final.name}.jar"
    todir="${maven.build.dir}/lib"/>

    <deploy:copy-deps todir="${maven.build.dir}/lib"/>

    </postGoal>


    As for my resources problem, that was fixed with:

    <resources>
    <resource>
    <directory>${basedir}/src/java</directory>
    <includes>
    <include>**/*.properties</include>
    </includes>
    </resource>
    </resources>


    Thanks for the help,

    Matt

    ---------- Forwarded Message -----------
    From: "Matt Raible" <matt@raibledesigns.com>
    To: "Maven Users List" <users@maven.apache.org>
    Sent: Thu, 29 May 2003 16:22:01 -0700
    Subject: Re: building jar in target/lib and copying dependencies

    Thanks, both answers where what I was looking for. I'm not building a webapp
    (yet). Currently, I'm copying all jars (including the built one) into
    target/lib, and then running:

    java -cp [all jars] package.className

    Adding the following helped me get my dependent jars into the target/lib
    directory:

    <postGoal name="jar">
    <j:forEach var="dep" items="${pom.dependencies}">
    <j:if test="${dep.getProperty('bundle.jar')=='true'}">
    <copy todir="${maven.build.dir}"
    file="${maven.repo.local}/${dep.artifactDirectory}/jars/
    ${dep.artifact}"/>
    </j:if>
    </j:forEach>
    </postGoal>

    Now, I'm running into a new problem. I have a Resources.properties file in
    my java/src/package... tree, and I want to include it in the jar.

    Unfortunately, this is not working:

    <resources>
    <includes>
    <include>**/*.properties</include>
    </includes>
    </resources>

    Thanks,

    Matt
    ------- End of Forwarded Message -------


    -- Matt Raible, Raible Designs, Morrison CO US
    -- Tel: +1 303 979-5340
    -- Mob: +1 720 560-8460
    -- Fax: +1 508 256-6471
    -- Web: http://www.raibledesigns.com

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
    For additional commands, e-mail: users-help@maven.apache.org
  • Martin Skopp at May 30, 2003 at 6:43 am
    Hi Matt,

    seems you found your solution already..
    ... anyway: but possibly the "uberjar" plugin does what you are looking
    for.

    To start the main class from CLI, I build a uberjar and start it with
    java -jar ueberjarfile.jar

    cu
    --
    Martin Skopp
    Riege Software International GmbH
    Support: mailto:maint@riege.com, Information: http://www.riege.com

    This email is intended to be viewed with a nonproportional font.
    Public Key on http://www.keyserver.net, Key-ID: 3D4027B5
    Fingerprint: 1970 C78D 9A1D 99FA 5CE4 5C0D 29E6 6A95 3D40 27B5


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
    For additional commands, e-mail: users-help@maven.apache.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriesmaven
postedMay 29, '03 at 10:19p
activeMay 30, '03 at 6:43a
posts5
users3
websitemaven.apache.org
irc#maven

People

Translate

site design / logo © 2019 Grokbase