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 4254828
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:08:11+00:00 2026-05-21T05:08:11+00:00

I have an existing java command-line program, that takes a bazillion of arguments and

  • 0

I have an existing java command-line program, that takes a bazillion of arguments and parses them using excellent args4j.

I now want to make a maven plugin mojo that will run the Java code contained in this application.

As of now, I’ve tried the basic way : replicating each and any command line argument into a mojo parameter. Bu I find this exceptionnally boring and error-prone, as maven mojo javadoc annotations are far less complete and integrated than can be args4j annotations.

So, using maven 3, is there a better way to have my executable run as a maven mojo ?
Oh, please don’t talk me about exec-maven-plugin, as I find it far too limited in that case (my executable will have to be run using a mix of project settings and user profile ones, and I guess simply calling maven-exec-plugin won’t do the trick).

  • 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-21T05:08:11+00:00Added an answer on May 21, 2026 at 5:08 am

    Although @khmarbaise’s answer is perfectly true on a general point of view, I would like to extend it a little.

    My standalone command-line application uses args4j, but I think the process can be fairly well copied using Commons CLI or (even more) JCommander which relies on the same command line annotations in a main bean.

    So, what I’ve done is a maven mojo that, using introspection, get the list of main bean command line arguments.
    For each of these arguments, I expect a property to be present in the project/settings infos. If this property is present, I build a fake command line using the option and the associated finally.

    Once I have browsed all options (stored as maven properties), I can use args4j to fill my bean, then run this bean using its main command.

    i think this approach could be quite well generalized, provided your application has a set of flags and a no-args run() method.

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

Sidebar

Related Questions

I have existing Java application that is using Acegi for authentication/authorization. Our new web
I have an existing library (JPhysX) that is a Java wrapper for a native
I have written a java program that is actually works as a gui to
We have a program with a main() that parses certain CLPs but does not
Assume we have a trivial Java program that consists of just one class: public
Let's say I have an existing application written in Java which I wish to
For whatever reason, I have a lot of clients that have existing data that's
We have an existing WCF service that makes use of wsDualHttpBinding to enable callbacks
I have an existing website that uses the same code base, but is deployed
I have an existing web app that allows users to rate items based on

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.