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 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 code and need to create Design Document based on that.
I have an existing system built in Java we currently expand that by adding
We have an existing java-based heavyweight project that needed an interactive script interpreter. After
I have an existing Java web application running on Linux using embedded Jetty. The
I have an existing java webapp that uses Hibernate for it's persistence. I've been
Assume we have a trivial Java program that consists of just one class: public
I have some existing code that accepts a java.sql.ResultSet that contains info retrieved from
I have existing code that uses CMNewProfileSearch to find then iterate over the color
I've recently started using Gradle and replacing my existing Maven-based projects. I have had
I have an requirement as per which I have to call an existing java

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.