You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Siddharth Jain <si...@gmail.com> on 2023/01/05 23:19:56 UTC
How to add a library to the classpath
Hello,
I am using mvn exec:java to run a program. It automatically adds all the
dependencies defined in the project's pom.xml to the Java classpath at
runtime which is good but I want to add some more libraries that I have
installed in M2 repository to the classpath at runtime and I do NOT want to
list them in the project's pom.xml. How can I do this? I tried searching
online but could not find an answer. Thanks,
Sid
Re: How to add a library to the classpath
Posted by Siddharth Jain <si...@gmail.com>.
in fact i don't think it works at all. tried using it like
-Dexec.additionalClasspathElements and doesn't work. i notice the
documentation only says:
Additional elements to be appended to the classpath.
for rest of the options the documentation also says:
*User property is*: exec.arguments.
to give an example.
On Thu, Jan 5, 2023 at 5:10 PM Siddharth Jain <si...@gmail.com> wrote:
> thanks. how do i separate multiple classpaths? tried : and , and none of
> them work.
>
> On Thu, Jan 5, 2023 at 3:58 PM Laird Nelson <lj...@gmail.com> wrote:
>
>> On Thu, Jan 5, 2023 at 3:20 PM Siddharth Jain <si...@gmail.com> wrote:
>>
>> > I am using mvn exec:java to run a program. […] I want to add some more
>> > libraries that I have
>> > installed in M2 repository to the classpath at runtime and I do NOT
>> want to
>> > list them in the project's pom.xml. How can I do this? I tried searching
>> > online but could not find an answer.
>> >
>>
>> The documentation for the exec-maven-plugin's java goal contains this:
>>
>> https://www.mojohaus.org/exec-maven-plugin/java-mojo.html#additionalClasspathElements
>>
>
Re: How to add a library to the classpath
Posted by Mantas Gridinas <mg...@gmail.com>.
I'm confused. Why would your users write additional entries intk your pom?
On Fri, Jan 6, 2023, 10:33 Delany <de...@gmail.com> wrote:
> Could this help?
>
> https://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.html
> Delany
>
> On Fri, 6 Jan 2023 at 05:30, Siddharth Jain <si...@gmail.com> wrote:
>
> > thanks. unfortunately this is exactly what i don't want to do. i am
> looking
> > for a command line solution. i don't want my users to have to write a
> > pom.xml to add additional dependencies to the classpath.
> >
> > On Thu, Jan 5, 2023 at 5:16 PM Greg Chabala <gr...@gmail.com>
> > wrote:
> >
> > > Try searching for an example:
> > >
> > >
> >
> https://github.com/search?l=Maven+POM&q=additionalClasspathElements&type=Code
> > >
> > > On Thu, Jan 5, 2023 at 7:11 PM Siddharth Jain <si...@gmail.com>
> > wrote:
> > >
> > > > thanks. how do i separate multiple classpaths? tried : and , and none
> > of
> > > > them work.
> > > >
> > > > On Thu, Jan 5, 2023 at 3:58 PM Laird Nelson <lj...@gmail.com>
> > wrote:
> > > >
> > > > > On Thu, Jan 5, 2023 at 3:20 PM Siddharth Jain <si...@gmail.com>
> > > > wrote:
> > > > >
> > > > > > I am using mvn exec:java to run a program. […] I want to add some
> > > more
> > > > > > libraries that I have
> > > > > > installed in M2 repository to the classpath at runtime and I do
> NOT
> > > > want
> > > > > to
> > > > > > list them in the project's pom.xml. How can I do this? I tried
> > > > searching
> > > > > > online but could not find an answer.
> > > > > >
> > > > >
> > > > > The documentation for the exec-maven-plugin's java goal contains
> > this:
> > > > >
> > > > >
> > > >
> > >
> >
> https://www.mojohaus.org/exec-maven-plugin/java-mojo.html#additionalClasspathElements
> > > > >
> > > >
> > >
> >
>
Re: Re: How to add a library to the classpath
Posted by Laird Nelson <lj...@gmail.com>.
On Fri, Jan 6, 2023 at 8:57 AM Laird Nelson <lj...@gmail.com> wrote:
> On Fri, Jan 6, 2023 at 8:55 AM Siddharth Jain <si...@gmail.com> wrote:
>
>> Thanks for your help. To keep the discussion focused, the ask is how to
>> add
>> additional dependencies/jars to the classpath when running a program using
>> mvn exec:java and from what i understand it is not possible.
>>
>
> Correction: it is possible. But actually you want to do it from the
> command line only, which (as documented) would require exec-maven-plugin
> 's java goal's additionalClasspathElements property to have a
> corresponding user.property that you could specify with a -D flag, which,
> as documented, it does not.
>
Finally, as documented, the exec-maven-plugin's java goal runs the
designated program with the classpath of the governing Maven process, so
just add items to the Maven classpath, i.e. the actual java classpath, when
you start Maven.
Best,
Laird
>
Re: Re: How to add a library to the classpath
Posted by Laird Nelson <lj...@gmail.com>.
On Fri, Jan 6, 2023 at 8:55 AM Siddharth Jain <si...@gmail.com> wrote:
> Thanks for your help. To keep the discussion focused, the ask is how to add
> additional dependencies/jars to the classpath when running a program using
> mvn exec:java and from what i understand it is not possible.
>
Correction: it is possible. But actually you want to do it from the command
line only, which (as documented) would require exec-maven-plugin's java
goal's additionalClasspathElements property to have a corresponding
user.property that you could specify with a -D flag, which, as documented,
it does not.
Best,
Laird
Re: Re: How to add a library to the classpath
Posted by Siddharth Jain <si...@gmail.com>.
I think as a user of maven the expected behavior (ask) is for the
additionalClasspathElements to support a user.property which it doesn't
currently. would be a good feature to add to maven exec plugin i believe.
thanks again to all for the help.
On Fri, Jan 6, 2023 at 9:33 AM Delany <de...@gmail.com> wrote:
> The way to separate multiple classpaths is to have multiple poms. You can
> make another child module (so that it inherits the base dependencies) and
> add the extra dependencies and the exec:java to THAT module.
> Delany
>
> On Fri, 6 Jan 2023 at 18:55, Siddharth Jain <si...@gmail.com> wrote:
>
> > Hi All,
> >
> > Thanks for your help. To keep the discussion focused, the ask is how to
> add
> > additional dependencies/jars to the classpath when running a program
> using
> > mvn exec:java and from what i understand it is not possible.
> >
> > I am using mvn dependency:build-classpath to get the full CP and then
> > augment it with additional jars and pass it to java (instead of
> > maven exec:java) as workaround. but that is not the question being asked.
> >
> > Sid
> >
> > On Fri, Jan 6, 2023 at 5:19 AM Eric Bresie <eb...@gmail.com> wrote:
> >
> > >
> > > Would using basic batch/shell specifying the dependencies with the Java
> > > classpath argument (without maven run) and the main runtime class be
> the
> > > alternative?
> > >
> > > Kind of a side question…when building with maven does it automate the
> > > addition dependencies within the META-INF/MANIFEST.MF (1) embedded
> within
> > > the jar?
> > >
> > > Eric Bresie
> > > Ebresie@gmail.com (mailto:Ebresie@gmail.com)
> > >
> > > References (1)
> > >
> https://stackoverflow.com/questions/70216/whats-the-purpose-of-meta-inf
> > > > On January 6, 2023 at 2:35:16 AM CST, Mantas Gridinas <
> > > mgridinas@gmail.com (mailto:mgridinas@gmail.com)> wrote:
> > > > I'm confused. Why would your users write additional entries intk your
> > > pom?
> > > >
> > > > On Fri, Jan 6, 2023, 10:33 (x-apple-data-detectors://4) Delany <
> > > delany.middleton@gmail.com (mailto:delany.middleton@gmail.com)> wrote:
> > > >
> > > > > Could this help?
> > > > >
> > > > >
> > >
> >
> https://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.html
> > > > > Delany
> > > > >
> > > > > On Fri, 6 Jan 2023 at 05:30, Siddharth Jain <siddhsql@gmail.com
> > > (mailto:siddhsql@gmail.com)> wrote:
> > > > >
> > > > > > thanks. unfortunately this is exactly what i don't want to do. i
> am
> > > > > looking
> > > > > > for a command line solution. i don't want my users to have to
> > write a
> > > > > > pom.xml to add additional dependencies to the classpath.
> > > > > >
> > > > > > On Thu, Jan 5, 2023 at 5:16 PM Greg Chabala <
> > greg.chabala@gmail.com
> > > (mailto:greg.chabala@gmail.com)>
> > > > > > wrote:
> > > > > >
> > > > > > > Try searching for an example:
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > >
> >
> https://github.com/search?l=Maven+POM&q=additionalClasspathElements&type=Code
> > > > > > >
> > > > > > > On Thu, Jan 5, 2023 at 7:11 PM Siddharth Jain <
> > siddhsql@gmail.com
> > > (mailto:siddhsql@gmail.com)>
> > > > > > wrote:
> > > > > > >
> > > > > > > > thanks. how do i separate multiple classpaths? tried : and ,
> > and
> > > none
> > > > > > of
> > > > > > > > them work.
> > > > > > > >
> > > > > > > > On Thu, Jan 5, 2023 at 3:58 PM Laird Nelson <
> > ljnelson@gmail.com
> > > (mailto:ljnelson@gmail.com)>
> > > > > > wrote:
> > > > > > > >
> > > > > > > > > On Thu, Jan 5, 2023 at 3:20 PM Siddharth Jain <
> > > siddhsql@gmail.com (mailto:siddhsql@gmail.com)>
> > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > > I am using mvn exec:java to run a program. […] I want to
> > add
> > > some
> > > > > > > more
> > > > > > > > > > libraries that I have
> > > > > > > > > > installed in M2 repository to the classpath at runtime
> and
> > I
> > > do
> > > > > NOT
> > > > > > > > want
> > > > > > > > > to
> > > > > > > > > > list them in the project's pom.xml. How can I do this? I
> > > tried
> > > > > > > > searching
> > > > > > > > > > online but could not find an answer.
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > > The documentation for the exec-maven-plugin's java goal
> > > contains
> > > > > > this:
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > >
> >
> https://www.mojohaus.org/exec-maven-plugin/java-mojo.html#additionalClasspathElements
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > >
> >
>
Re: Re: How to add a library to the classpath
Posted by Delany <de...@gmail.com>.
The way to separate multiple classpaths is to have multiple poms. You can
make another child module (so that it inherits the base dependencies) and
add the extra dependencies and the exec:java to THAT module.
Delany
On Fri, 6 Jan 2023 at 18:55, Siddharth Jain <si...@gmail.com> wrote:
> Hi All,
>
> Thanks for your help. To keep the discussion focused, the ask is how to add
> additional dependencies/jars to the classpath when running a program using
> mvn exec:java and from what i understand it is not possible.
>
> I am using mvn dependency:build-classpath to get the full CP and then
> augment it with additional jars and pass it to java (instead of
> maven exec:java) as workaround. but that is not the question being asked.
>
> Sid
>
> On Fri, Jan 6, 2023 at 5:19 AM Eric Bresie <eb...@gmail.com> wrote:
>
> >
> > Would using basic batch/shell specifying the dependencies with the Java
> > classpath argument (without maven run) and the main runtime class be the
> > alternative?
> >
> > Kind of a side question…when building with maven does it automate the
> > addition dependencies within the META-INF/MANIFEST.MF (1) embedded within
> > the jar?
> >
> > Eric Bresie
> > Ebresie@gmail.com (mailto:Ebresie@gmail.com)
> >
> > References (1)
> > https://stackoverflow.com/questions/70216/whats-the-purpose-of-meta-inf
> > > On January 6, 2023 at 2:35:16 AM CST, Mantas Gridinas <
> > mgridinas@gmail.com (mailto:mgridinas@gmail.com)> wrote:
> > > I'm confused. Why would your users write additional entries intk your
> > pom?
> > >
> > > On Fri, Jan 6, 2023, 10:33 (x-apple-data-detectors://4) Delany <
> > delany.middleton@gmail.com (mailto:delany.middleton@gmail.com)> wrote:
> > >
> > > > Could this help?
> > > >
> > > >
> >
> https://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.html
> > > > Delany
> > > >
> > > > On Fri, 6 Jan 2023 at 05:30, Siddharth Jain <siddhsql@gmail.com
> > (mailto:siddhsql@gmail.com)> wrote:
> > > >
> > > > > thanks. unfortunately this is exactly what i don't want to do. i am
> > > > looking
> > > > > for a command line solution. i don't want my users to have to
> write a
> > > > > pom.xml to add additional dependencies to the classpath.
> > > > >
> > > > > On Thu, Jan 5, 2023 at 5:16 PM Greg Chabala <
> greg.chabala@gmail.com
> > (mailto:greg.chabala@gmail.com)>
> > > > > wrote:
> > > > >
> > > > > > Try searching for an example:
> > > > > >
> > > > > >
> > > > >
> > > >
> >
> https://github.com/search?l=Maven+POM&q=additionalClasspathElements&type=Code
> > > > > >
> > > > > > On Thu, Jan 5, 2023 at 7:11 PM Siddharth Jain <
> siddhsql@gmail.com
> > (mailto:siddhsql@gmail.com)>
> > > > > wrote:
> > > > > >
> > > > > > > thanks. how do i separate multiple classpaths? tried : and ,
> and
> > none
> > > > > of
> > > > > > > them work.
> > > > > > >
> > > > > > > On Thu, Jan 5, 2023 at 3:58 PM Laird Nelson <
> ljnelson@gmail.com
> > (mailto:ljnelson@gmail.com)>
> > > > > wrote:
> > > > > > >
> > > > > > > > On Thu, Jan 5, 2023 at 3:20 PM Siddharth Jain <
> > siddhsql@gmail.com (mailto:siddhsql@gmail.com)>
> > > > > > > wrote:
> > > > > > > >
> > > > > > > > > I am using mvn exec:java to run a program. […] I want to
> add
> > some
> > > > > > more
> > > > > > > > > libraries that I have
> > > > > > > > > installed in M2 repository to the classpath at runtime and
> I
> > do
> > > > NOT
> > > > > > > want
> > > > > > > > to
> > > > > > > > > list them in the project's pom.xml. How can I do this? I
> > tried
> > > > > > > searching
> > > > > > > > > online but could not find an answer.
> > > > > > > > >
> > > > > > > >
> > > > > > > > The documentation for the exec-maven-plugin's java goal
> > contains
> > > > > this:
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> >
> https://www.mojohaus.org/exec-maven-plugin/java-mojo.html#additionalClasspathElements
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> >
>
Re: Re: How to add a library to the classpath
Posted by Siddharth Jain <si...@gmail.com>.
Hi All,
Thanks for your help. To keep the discussion focused, the ask is how to add
additional dependencies/jars to the classpath when running a program using
mvn exec:java and from what i understand it is not possible.
I am using mvn dependency:build-classpath to get the full CP and then
augment it with additional jars and pass it to java (instead of
maven exec:java) as workaround. but that is not the question being asked.
Sid
On Fri, Jan 6, 2023 at 5:19 AM Eric Bresie <eb...@gmail.com> wrote:
>
> Would using basic batch/shell specifying the dependencies with the Java
> classpath argument (without maven run) and the main runtime class be the
> alternative?
>
> Kind of a side question…when building with maven does it automate the
> addition dependencies within the META-INF/MANIFEST.MF (1) embedded within
> the jar?
>
> Eric Bresie
> Ebresie@gmail.com (mailto:Ebresie@gmail.com)
>
> References (1)
> https://stackoverflow.com/questions/70216/whats-the-purpose-of-meta-inf
> > On January 6, 2023 at 2:35:16 AM CST, Mantas Gridinas <
> mgridinas@gmail.com (mailto:mgridinas@gmail.com)> wrote:
> > I'm confused. Why would your users write additional entries intk your
> pom?
> >
> > On Fri, Jan 6, 2023, 10:33 (x-apple-data-detectors://4) Delany <
> delany.middleton@gmail.com (mailto:delany.middleton@gmail.com)> wrote:
> >
> > > Could this help?
> > >
> > >
> https://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.html
> > > Delany
> > >
> > > On Fri, 6 Jan 2023 at 05:30, Siddharth Jain <siddhsql@gmail.com
> (mailto:siddhsql@gmail.com)> wrote:
> > >
> > > > thanks. unfortunately this is exactly what i don't want to do. i am
> > > looking
> > > > for a command line solution. i don't want my users to have to write a
> > > > pom.xml to add additional dependencies to the classpath.
> > > >
> > > > On Thu, Jan 5, 2023 at 5:16 PM Greg Chabala <greg.chabala@gmail.com
> (mailto:greg.chabala@gmail.com)>
> > > > wrote:
> > > >
> > > > > Try searching for an example:
> > > > >
> > > > >
> > > >
> > >
> https://github.com/search?l=Maven+POM&q=additionalClasspathElements&type=Code
> > > > >
> > > > > On Thu, Jan 5, 2023 at 7:11 PM Siddharth Jain <siddhsql@gmail.com
> (mailto:siddhsql@gmail.com)>
> > > > wrote:
> > > > >
> > > > > > thanks. how do i separate multiple classpaths? tried : and , and
> none
> > > > of
> > > > > > them work.
> > > > > >
> > > > > > On Thu, Jan 5, 2023 at 3:58 PM Laird Nelson <ljnelson@gmail.com
> (mailto:ljnelson@gmail.com)>
> > > > wrote:
> > > > > >
> > > > > > > On Thu, Jan 5, 2023 at 3:20 PM Siddharth Jain <
> siddhsql@gmail.com (mailto:siddhsql@gmail.com)>
> > > > > > wrote:
> > > > > > >
> > > > > > > > I am using mvn exec:java to run a program. […] I want to add
> some
> > > > > more
> > > > > > > > libraries that I have
> > > > > > > > installed in M2 repository to the classpath at runtime and I
> do
> > > NOT
> > > > > > want
> > > > > > > to
> > > > > > > > list them in the project's pom.xml. How can I do this? I
> tried
> > > > > > searching
> > > > > > > > online but could not find an answer.
> > > > > > > >
> > > > > > >
> > > > > > > The documentation for the exec-maven-plugin's java goal
> contains
> > > > this:
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> https://www.mojohaus.org/exec-maven-plugin/java-mojo.html#additionalClasspathElements
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
>
Re: Re: How to add a library to the classpath
Posted by Eric Bresie <eb...@gmail.com>.
Would using basic batch/shell specifying the dependencies with the Java classpath argument (without maven run) and the main runtime class be the alternative?
Kind of a side question…when building with maven does it automate the addition dependencies within the META-INF/MANIFEST.MF (1) embedded within the jar?
Eric Bresie
Ebresie@gmail.com (mailto:Ebresie@gmail.com)
References (1) https://stackoverflow.com/questions/70216/whats-the-purpose-of-meta-inf
> On January 6, 2023 at 2:35:16 AM CST, Mantas Gridinas <mgridinas@gmail.com (mailto:mgridinas@gmail.com)> wrote:
> I'm confused. Why would your users write additional entries intk your pom?
>
> On Fri, Jan 6, 2023, 10:33 (x-apple-data-detectors://4) Delany <delany.middleton@gmail.com (mailto:delany.middleton@gmail.com)> wrote:
>
> > Could this help?
> >
> > https://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.html
> > Delany
> >
> > On Fri, 6 Jan 2023 at 05:30, Siddharth Jain <siddhsql@gmail.com (mailto:siddhsql@gmail.com)> wrote:
> >
> > > thanks. unfortunately this is exactly what i don't want to do. i am
> > looking
> > > for a command line solution. i don't want my users to have to write a
> > > pom.xml to add additional dependencies to the classpath.
> > >
> > > On Thu, Jan 5, 2023 at 5:16 PM Greg Chabala <greg.chabala@gmail.com (mailto:greg.chabala@gmail.com)>
> > > wrote:
> > >
> > > > Try searching for an example:
> > > >
> > > >
> > >
> > https://github.com/search?l=Maven+POM&q=additionalClasspathElements&type=Code
> > > >
> > > > On Thu, Jan 5, 2023 at 7:11 PM Siddharth Jain <siddhsql@gmail.com (mailto:siddhsql@gmail.com)>
> > > wrote:
> > > >
> > > > > thanks. how do i separate multiple classpaths? tried : and , and none
> > > of
> > > > > them work.
> > > > >
> > > > > On Thu, Jan 5, 2023 at 3:58 PM Laird Nelson <ljnelson@gmail.com (mailto:ljnelson@gmail.com)>
> > > wrote:
> > > > >
> > > > > > On Thu, Jan 5, 2023 at 3:20 PM Siddharth Jain <siddhsql@gmail.com (mailto:siddhsql@gmail.com)>
> > > > > wrote:
> > > > > >
> > > > > > > I am using mvn exec:java to run a program. […] I want to add some
> > > > more
> > > > > > > libraries that I have
> > > > > > > installed in M2 repository to the classpath at runtime and I do
> > NOT
> > > > > want
> > > > > > to
> > > > > > > list them in the project's pom.xml. How can I do this? I tried
> > > > > searching
> > > > > > > online but could not find an answer.
> > > > > > >
> > > > > >
> > > > > > The documentation for the exec-maven-plugin's java goal contains
> > > this:
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> > https://www.mojohaus.org/exec-maven-plugin/java-mojo.html#additionalClasspathElements
> > > > > >
> > > > >
> > > >
> > >
> >
Re: How to add a library to the classpath
Posted by Delany <de...@gmail.com>.
Could this help?
https://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.html
Delany
On Fri, 6 Jan 2023 at 05:30, Siddharth Jain <si...@gmail.com> wrote:
> thanks. unfortunately this is exactly what i don't want to do. i am looking
> for a command line solution. i don't want my users to have to write a
> pom.xml to add additional dependencies to the classpath.
>
> On Thu, Jan 5, 2023 at 5:16 PM Greg Chabala <gr...@gmail.com>
> wrote:
>
> > Try searching for an example:
> >
> >
> https://github.com/search?l=Maven+POM&q=additionalClasspathElements&type=Code
> >
> > On Thu, Jan 5, 2023 at 7:11 PM Siddharth Jain <si...@gmail.com>
> wrote:
> >
> > > thanks. how do i separate multiple classpaths? tried : and , and none
> of
> > > them work.
> > >
> > > On Thu, Jan 5, 2023 at 3:58 PM Laird Nelson <lj...@gmail.com>
> wrote:
> > >
> > > > On Thu, Jan 5, 2023 at 3:20 PM Siddharth Jain <si...@gmail.com>
> > > wrote:
> > > >
> > > > > I am using mvn exec:java to run a program. […] I want to add some
> > more
> > > > > libraries that I have
> > > > > installed in M2 repository to the classpath at runtime and I do NOT
> > > want
> > > > to
> > > > > list them in the project's pom.xml. How can I do this? I tried
> > > searching
> > > > > online but could not find an answer.
> > > > >
> > > >
> > > > The documentation for the exec-maven-plugin's java goal contains
> this:
> > > >
> > > >
> > >
> >
> https://www.mojohaus.org/exec-maven-plugin/java-mojo.html#additionalClasspathElements
> > > >
> > >
> >
>
Re: How to add a library to the classpath
Posted by Arnaud bourree <ar...@gmail.com>.
Hi,
Maven without pom.xml?
Why don't you write shell script in this case?
Arnaud
Le ven. 6 janv. 2023, 04:30, Siddharth Jain <si...@gmail.com> a écrit :
> thanks. unfortunately this is exactly what i don't want to do. i am looking
> for a command line solution. i don't want my users to have to write a
> pom.xml to add additional dependencies to the classpath.
>
> On Thu, Jan 5, 2023 at 5:16 PM Greg Chabala <gr...@gmail.com>
> wrote:
>
> > Try searching for an example:
> >
> >
> https://github.com/search?l=Maven+POM&q=additionalClasspathElements&type=Code
> >
> > On Thu, Jan 5, 2023 at 7:11 PM Siddharth Jain <si...@gmail.com>
> wrote:
> >
> > > thanks. how do i separate multiple classpaths? tried : and , and none
> of
> > > them work.
> > >
> > > On Thu, Jan 5, 2023 at 3:58 PM Laird Nelson <lj...@gmail.com>
> wrote:
> > >
> > > > On Thu, Jan 5, 2023 at 3:20 PM Siddharth Jain <si...@gmail.com>
> > > wrote:
> > > >
> > > > > I am using mvn exec:java to run a program. […] I want to add some
> > more
> > > > > libraries that I have
> > > > > installed in M2 repository to the classpath at runtime and I do NOT
> > > want
> > > > to
> > > > > list them in the project's pom.xml. How can I do this? I tried
> > > searching
> > > > > online but could not find an answer.
> > > > >
> > > >
> > > > The documentation for the exec-maven-plugin's java goal contains
> this:
> > > >
> > > >
> > >
> >
> https://www.mojohaus.org/exec-maven-plugin/java-mojo.html#additionalClasspathElements
> > > >
> > >
> >
>
Re: How to add a library to the classpath
Posted by Siddharth Jain <si...@gmail.com>.
thanks. unfortunately this is exactly what i don't want to do. i am looking
for a command line solution. i don't want my users to have to write a
pom.xml to add additional dependencies to the classpath.
On Thu, Jan 5, 2023 at 5:16 PM Greg Chabala <gr...@gmail.com> wrote:
> Try searching for an example:
>
> https://github.com/search?l=Maven+POM&q=additionalClasspathElements&type=Code
>
> On Thu, Jan 5, 2023 at 7:11 PM Siddharth Jain <si...@gmail.com> wrote:
>
> > thanks. how do i separate multiple classpaths? tried : and , and none of
> > them work.
> >
> > On Thu, Jan 5, 2023 at 3:58 PM Laird Nelson <lj...@gmail.com> wrote:
> >
> > > On Thu, Jan 5, 2023 at 3:20 PM Siddharth Jain <si...@gmail.com>
> > wrote:
> > >
> > > > I am using mvn exec:java to run a program. […] I want to add some
> more
> > > > libraries that I have
> > > > installed in M2 repository to the classpath at runtime and I do NOT
> > want
> > > to
> > > > list them in the project's pom.xml. How can I do this? I tried
> > searching
> > > > online but could not find an answer.
> > > >
> > >
> > > The documentation for the exec-maven-plugin's java goal contains this:
> > >
> > >
> >
> https://www.mojohaus.org/exec-maven-plugin/java-mojo.html#additionalClasspathElements
> > >
> >
>
Re: How to add a library to the classpath
Posted by Greg Chabala <gr...@gmail.com>.
Try searching for an example:
https://github.com/search?l=Maven+POM&q=additionalClasspathElements&type=Code
On Thu, Jan 5, 2023 at 7:11 PM Siddharth Jain <si...@gmail.com> wrote:
> thanks. how do i separate multiple classpaths? tried : and , and none of
> them work.
>
> On Thu, Jan 5, 2023 at 3:58 PM Laird Nelson <lj...@gmail.com> wrote:
>
> > On Thu, Jan 5, 2023 at 3:20 PM Siddharth Jain <si...@gmail.com>
> wrote:
> >
> > > I am using mvn exec:java to run a program. […] I want to add some more
> > > libraries that I have
> > > installed in M2 repository to the classpath at runtime and I do NOT
> want
> > to
> > > list them in the project's pom.xml. How can I do this? I tried
> searching
> > > online but could not find an answer.
> > >
> >
> > The documentation for the exec-maven-plugin's java goal contains this:
> >
> >
> https://www.mojohaus.org/exec-maven-plugin/java-mojo.html#additionalClasspathElements
> >
>
Re: How to add a library to the classpath
Posted by Siddharth Jain <si...@gmail.com>.
thanks. how do i separate multiple classpaths? tried : and , and none of
them work.
On Thu, Jan 5, 2023 at 3:58 PM Laird Nelson <lj...@gmail.com> wrote:
> On Thu, Jan 5, 2023 at 3:20 PM Siddharth Jain <si...@gmail.com> wrote:
>
> > I am using mvn exec:java to run a program. […] I want to add some more
> > libraries that I have
> > installed in M2 repository to the classpath at runtime and I do NOT want
> to
> > list them in the project's pom.xml. How can I do this? I tried searching
> > online but could not find an answer.
> >
>
> The documentation for the exec-maven-plugin's java goal contains this:
>
> https://www.mojohaus.org/exec-maven-plugin/java-mojo.html#additionalClasspathElements
>
Re: How to add a library to the classpath
Posted by Laird Nelson <lj...@gmail.com>.
On Thu, Jan 5, 2023 at 3:20 PM Siddharth Jain <si...@gmail.com> wrote:
> I am using mvn exec:java to run a program. […] I want to add some more
> libraries that I have
> installed in M2 repository to the classpath at runtime and I do NOT want to
> list them in the project's pom.xml. How can I do this? I tried searching
> online but could not find an answer.
>
The documentation for the exec-maven-plugin's java goal contains this:
https://www.mojohaus.org/exec-maven-plugin/java-mojo.html#additionalClasspathElements