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 <ebre...@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
> ebre...@gmail.com (mailto:ebre...@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 <
> mgridi...@gmail.com (mailto:mgridi...@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.middle...@gmail.com (mailto:delany.middle...@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 <siddh...@gmail.com
> (mailto:siddh...@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.chab...@gmail.com
> (mailto:greg.chab...@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 <siddh...@gmail.com
> (mailto:siddh...@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 <ljnel...@gmail.com
> (mailto:ljnel...@gmail.com)>
> > > > wrote:
> > > > > >
> > > > > > > On Thu, Jan 5, 2023 at 3:20 PM Siddharth Jain <
> siddh...@gmail.com (mailto:siddh...@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
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
>

Reply via email to