Hi Dan,

> What I really need is a way to determine only the deps (and sub deps)
> for the application itself.

Maven makes this really easy. As others have said, the dependency plugin
has several helpful goals.

If all you need is to _list_ the dependencies, then you already found
dependency:tree. There is also dependency:list which gives you a flat list.
And then there is Eclipse (via the M2E plugin), which has a beautiful and
searchable Dependencies view if you double-click the pom.xml file.

If what you need is all the JAR files in a single place, then try:

    mvn dependency:copy-dependencies

This actually copies all JAR files of your project's dependencies into the
target/dependencies folder. You can then ZIP them up or do whatever with
them.

If you want to automate that process, then the maven-assembly-plugin is
your best friend. You can tell it to make an archive containing your
application JAR, dependency JARs, and other resources. It is highly
configurable. The documentation is a bit arcane, but it is really worth
learning. If you get stuck, just ask for help here!

If what you want is to use Maven to _launch_ your application, then the
exec-maven-plugin is what you need. It has an exec:java goal that launches
the given Java main class, with all the dependencies on your classpath.

And in all cases, you should never need to do anything crazy with
~/.m2/repository. Please understand that that is a _cache_ used by the mvn
tools, and not intended for use facilitating your build or deployment
processes. I would strongly suggest working with Maven for a bit longer
before you decide to try doing anything clever with the repo cache.

Regards,
Curtis

On Wed, Mar 11, 2015 at 10:22 AM, Dan <dc12...@gmail.com> wrote:

> Thanks again for the help.  I understand that what I'm doing is not
> standard, but I still have to implement.
> So I know if i run dependency:tree on a simple pom with no deps, I still
> get well over 200 artifacts downloaded. So I am also under the assumption
> that the majority are requirements of maven or the dep plugin rather then
> my app.
>
> What I really need is a way to determine only the deps (and sub deps) for
> the application itself.
>
> I have two approaches I'm thinking of taking.
> 1. (Doesn't meet the all the requirements, but gets me out of a jam
> temporarily).   Instead of creating rpms for every artifact, only package
> up the ones which actually have a jar file in the directory.
>
> 2. Parse the output of dependency:tree, and package up only what is listed
> in that visual ascii tree. (ie: grep '^\[INFO\]').  I'm just don't know if
> I can be 100% sure that the tree does in fact list everything that I need.
>
>
>
> Here are the somewhat sanitized pom files, and the output i'm getting.
>
> # App 1
> http://pastebin.com/raw.php?i=Dg3Fbaue
> http://pastebin.com/raw.php?i=NEhrtwF4
>
>
> # App 2
> http://pastebin.com/raw.php?i=180zUFLe
> http://pastebin.com/raw.php?i=VEueXysC
>
>
>
>
>
>
>
>
>
>
>
>
> On 03/11/2015 02:19 AM, Baptiste Mathus wrote:
>
>> Oh right, I didn't get your meaning. You're right, could be that, indeed.
>> Should check the plugin sources to be sure.
>>
>> 2015-03-11 7:06 GMT+01:00 Cintia Del Rio <miladyarte...@gmail.com>:
>>
>>  When you invoke the dependency:tree, maven will download the dependency
>>> tree plugin and all the dependencies it needs to run that plugin.
>>>
>>>
>>> So I'd expect that every jar you now have in your local repository
>>> (~/.m2)
>>> is a dependency of the dependency:tree plugin.
>>>
>>> On 11 March 2015 at 17:02, Baptiste Mathus <m...@batmat.net> wrote:
>>>
>>>  Could you rephrase? You think pom.xml is a dependency of the
>>>> "dependency:tree" goal? If so, then the answer is no.
>>>>
>>>> Cheers
>>>>
>>>> 2015-03-11 6:59 GMT+01:00 Cintia Del Rio <miladyarte...@gmail.com>:
>>>>
>>>>  Isn't it a dependency of the dependency plugin itself?
>>>>>
>>>>> On 11 March 2015 at 16:51, Baptiste Mathus <bmat...@batmat.net> wrote:
>>>>>
>>>>>  Well, in that case, since you're asking for the dependency:tree I'm
>>>>>>
>>>>> even
>>>>
>>>>> surprised there's any jar downloaded. Maven would only need pom to
>>>>>>
>>>>> compute
>>>>>
>>>>>> that. Downloading Jars is only done when needed (say for compiling,
>>>>>>
>>>>> etc.)
>>>>
>>>>> Btw, do you really type "mvn dependency:tree pom.xml" ? What do you
>>>>>>
>>>>> expect?
>>>>>
>>>>>> The "pom.xml" part is gonna lead to an error since pom.xml is not a
>>>>>>
>>>>> goal
>>>>
>>>>> and that's what's supposed to be listed after mvn.
>>>>>>
>>>>>> As for your question: I suppose oro is a transitive dependency of one
>>>>>>
>>>>> of
>>>>
>>>>> the things you depend on. mvn dependency:tree should generally show
>>>>>>
>>>>> it
>>>
>>>> btw.
>>>>>
>>>>>> Cheers
>>>>>>
>>>>>> 2015-03-10 15:22 GMT+01:00 D C <dc12...@gmail.com>:
>>>>>>
>>>>>>  I am trying to download all dependencies from a pom file.  My steps
>>>>>>>
>>>>>> are:
>>>>>
>>>>>> 1. delete .m2/repository
>>>>>>> 2. mvn dependency:tree pom.xml
>>>>>>>
>>>>>>> Everything looks good, however as I browse the .m2 directory I can
>>>>>>>
>>>>>> see
>>>>
>>>>> that
>>>>>>
>>>>>>> for some artifacts  maven only downloaded the pom file, and did not
>>>>>>> download the associated jar.  I then repeat the process on another
>>>>>>>
>>>>>> pom
>>>>
>>>>> file.  This time the jar file is present for that same artifact.
>>>>>>>
>>>>>>> There are multiple artifacts that this happens on, but for
>>>>>>>
>>>>>> troubleshooting
>>>>>>
>>>>>>> I'm just focusing on oro-2.0.8.   Neither of my poms declare oro,
>>>>>>>
>>>>>> so
>>>
>>>> this
>>>>>
>>>>>> is a sub-dependency somewhere down the chain.  The process can be
>>>>>>> reproduced every time,  and I can see from the output that the
>>>>>>>
>>>>>> oro-2.0.8
>>>>>
>>>>>> pom file is downloaded from the same location (local artifactory)
>>>>>>>
>>>>>> in
>>>
>>>> both
>>>>>
>>>>>> cases.
>>>>>>>
>>>>>>>
>>>>>>> Does anyone know why maven would download a pom file, and then not
>>>>>>>
>>>>>> attempt
>>>>>>
>>>>>>> to download the associated jar?
>>>>>>>
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Dan
>>>>>>>
>>>>>>>
>>>
>>> --
>>> -------
>>> Sent from TARDIS. Typos might be a timey whyney thingy.
>>> Enviado da TARDIS, podem existir erros devido à diferenças de
>>> espaço-tempo.
>>>
>>> Cintia Del Rio
>>>
>>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

Reply via email to