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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:38:22+00:00 2026-06-13T13:38:22+00:00

I am running a Maven project from eclipse and want to setup a Run

  • 0

I am running a Maven project from eclipse and want to setup a Run Configuration with Goals compile exec:java, which needs a exec.mainClass parameter. Because I have different main classes in my project, I would like class and package name the currently selected resource to be used when running. What are the correct Run Variable to insert as a value for the parameter?

  • 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-13T13:38:23+00:00Added an answer on June 13, 2026 at 1:38 pm

    I use the following configuration to quickly run the main method of the currently selected class. I know you just asked for the parameters but it I’ll provide more detailed steps for other visitors since I didn’t found any solution on the net.

    Prerequisite: m2e eclipse plugin, exec-maven-plugin

    1. Select Run as > Maven build …
    2. Use the goal exec:java
    3. optional: provide a profile name
    4. optional: Select Debug Output
    5. Click Add … to create a parameter
      • Name: exec.mainClass
      • Value: ${java_type_name} (this provides the currently selected resource’s full java name)

    Now whenever you use this run configuration it will take the current class as parameter and execute its main method. The ${java_type_name} variable is provided by eclipse, so it should also work somehow without using m2e.

    One thing to mention is that the exec.mainClass parameter didn’t work for me when I provided a goal and default configuration in the pom.xml. Not sure if it’s a bug, I did something wrong, or simply not possible. I had to remove any goals and just include the plugin without configuring it in the build to make it work:

    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.2.1</version>
    </plugin>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I run a Maven build in NetBeans which starts a long-running Java process
I have a maven project built in '/some/where' which I wish to run/execute from
I am using Eclipse Maven (m2e) inside Eclipse and I am running my project
I'm running Eclipse Indigo on Mac 10.7.4. I have a Maven (3.0.3) project set
I'm Running My Eclipse (Helios) in Ubuntu. I've added exec Maven Plug in. When
I have a Maven Project in Eclipse. I want to deploy it in my
I have a maven project under eclipse with m2eclipse. WHen running integration tests the
I have java project that depends from other java projects. These projects are maven
I am using Maven in my Java project and the IDE is Eclipse. I
I want to move a long-running process in an Java EE application from synchronous

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.