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

  • SEARCH
  • Home
  • 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 7982431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:40:46+00:00 2026-06-04T10:40:46+00:00

I don’t get it. I’ve set up my pom.xml to use the Maven exec

  • 0

I don’t get it. I’ve set up my pom.xml to use the Maven exec plugin so I can execute some of the classes in my project with the correct classpath, -D defines and -javaagent. So from a shell with the classes built in ./target/classes etc.. I can run the main() methods using

mvn exec:java -Dexec:mainClass=classWithAMainMethod

All good so far.

Now I want to ship my project(a jar artifact) and I still want to be able to use the configuration I’ve put in the pom.xml for running the classes with the correct arguments etc.. How do I do it? Is there some way of staying

mvn -artifactJar=MyArtifact.jar exec:java -Dexec:mainClass=classWithAMainMethod

when all I have is MyArtifact.jar(Or a maven repository with MyArtifact.jar in it)??

I’ve tried the following:

  • Get the jar with the dependency:get goal and unzip it. I can’t do anything with it
    as the pom.xml seems to end up in META-INF/maven in the artifact jar. Is there any way of using it?

  • Creating a dummy pom where I want to run my project with a single dependency on my projects artifact. I can then use exec:java to run the main classes but it’s dosen’t uses the configuration from my projects pom.

Thanks.

  • 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-06-04T10:40:47+00:00Added an answer on June 4, 2026 at 10:40 am

    The AppAssembler plugin worked out quite well for me. I replaced the exec plugin config in my project’s pom with something like this in the build section:

    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>appassembler-maven-plugin</artifactId>
        <version>1.2.2</version>
        <configuration>
            <repositoryLayout>flat</repositoryLayout>
            <repositoryName>lib</repositoryName>
            <extraJvmArguments>
                -Djava.rmi.server.hostname=localhost
                -javaagent:${spring.javaagent.jar}
            </extraJvmArguments>
            <programs>
                <program>
                    <name>foo1</name>
                    <mainClass>net.foor.FooMain</mainClass>
                </program>
                   ...
        </configuration>
    </plugin>
    

    In Eclipse I created an external tools launcher to run the resulting scripts from target/appassembler/bin

    On the machine I wanted to deploy to(Assuming access to the internal Maven repository where my artifact+dependencies have been installed/deployed):

    • First use wget or mvn dependency:get to get a copy of my artifact jar.
    • Extract the pom. unzip -j artifact.jar */pom.xml*
    • Run mvn appassembler:assemble -DassembleDirectory=.
    • Move the artifact.jar into the ./lib directory
    • Set execute permissions on generated shell scripts in ./bin
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Don't they both have to convert to machine code at some point to execute
Don't have much to say, just can get into the event handler. XAML: <Grid>
Don't ask me why but i can't use this method because I need to
Don't know how to explain it better but i'm trying to get a response
Don't know if anyone can help me with this or if it's even possible.
Don't be afraid to use any technical jargon or low-level explanations for things, please.
Don't know why this doesn't work. I can't do implicit animation for a newly
Don't these two mean the same thing, first get the value and then increment?
Don't ask me how but I managed to get accidentally the following remote branches
Don't get me wrong, I want them to get saved. But I always thought

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.