Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 608059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:25:26+00:00 2026-05-13T17:25:26+00:00

I’m trying to write a pom.xml that will allow me to run a command

  • 0

I’m trying to write a pom.xml that will allow me to run a command locally and fetch all dependencies that my jruby Rails app has. I’m seeing two different configs though and I’m not totally sure which to use (as I’m not a java person whatsoever)

First, many Pom’s i’m seeing just have a tag under the root of the pom.xml that list all dependencies. This doesn’t however have any information about where these are stored etc… so I feel like this isn’t what I want (I need to copy them to my rails lib dir)

Second option, I’m seeing in the mvn docs is to use the maven-dependency-plugin, which seems more like what i’m looking for. I assume then that my outputDirectory would be something like lib

So I don’t fully understand what the purpose of the first option’s dependency list is for. All I want is mvn to copy my jars locally (and then eventually when my CI server does a deploy). Can someone point me in the right direction?

First Option

<project>
  <dependencies> 
   <dependency>
     <groupId>commons-lang</groupId>
     <artifactId>commons-lang</artifactId>
     <version>2.4</version>
   </dependency>
</project>

Second Option

<project>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <configuration>
          <artifactItems>
            <artifactItem>
              <groupId>[ groupId ]</groupId>
              <artifactId>[ artifactId ]</artifactId>
              <version>[ version ]</version>
              <type>[ packaging ]</type>
              <classifier> [classifier - optional] </classifier>
              <overWrite>[ true or false ]</overWrite>
              <outputDirectory>[ output directory ]</outputDirectory>
              <destFileName>[ filename ]</destFileName>
            </artifactItem>
          </artifactItems>
          <!-- other configurations here -->
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:25:26+00:00Added an answer on May 13, 2026 at 5:25 pm

    First, many Pom’s i’m seeing just have a tag under the root of the pom.xml that list all dependencies. This doesn’t however have any information about where these are stored etc… so I feel like this isn’t what I want (I need to copy them to my rails lib dir)

    This is the traditional way to declare and use dependencies on a Java project. Dependencies declared under the <dependencies> element are downloaded from a “remote repository” and installed to your “local repository” (in ~/.m2/repository by default) and artifacts are then handled from there. Maven projects (at least the Java ones) don’t use a local lib/ folder for their dependencies.

    Second option, I’m seeing in the mvn docs is to use the maven-dependency-plugin, which seems more like what i’m looking for. I assume then that my outputDirectory would be something like lib

    The maven dependency plugin allows to interact with artifacts and to copy/unpack them from the local or remote repositories to a specified location. So it can be used to get some dependencies and copy them in lets say a lib/ directory indeed. Actually, it has several goals allowing to do this:

    • dependency:copy takes a list of artifacts defined in the plugin
      configuration section and copies them
      to a specified location, renaming them
      or stripping the version if desired.
      This goal can resolve the artifacts
      from remote repositories if they don’t
      exist in local.
    • dependency:copy-dependencies takes the list of project direct
      dependencies and optionally transitive
      dependencies and copies them to a
      specified location, stripping the
      version if desired. This goal can also
      be run from the command line.

    The first goal would use the setup you described in your second option. The second goal would use the standard project dependencies that you described in your first option. Both approaches would work.

    The problem here is that I don’t know exactly what a JRuby Rails app is, what the development workflow is, how to build such an app, etc so I don’t know exactly what you need to do and, consequently, what would be the best way to implement that with Maven.

    So I googled a bit and found this post that shows another approach based on OS commands (using the maven exec plugin) and has a complete pom.xml doing some other things. Maybe you should look at it and use it as a starting point instead of reinventing everything. This is my suggestion actually.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 380k
  • Answers 380k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This is not part of the public API. Hopefully it… May 14, 2026 at 9:54 pm
  • Editorial Team
    Editorial Team added an answer Probably the simplest way to store that as an integer… May 14, 2026 at 9:54 pm
  • Editorial Team
    Editorial Team added an answer You need to pass a pointer to a pointer as… May 14, 2026 at 9:54 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.