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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:21:32+00:00 2026-06-17T12:21:32+00:00

My project has a few JUnit tests that I rarely want to run. To

  • 0

My project has a few JUnit tests that I rarely want to run. To do so I put them in a @Category and then I did this:

<plugin>
   <artifactId>maven-surefire-plugin</artifactId>
   <!-- Run all but the inject tests -->
   <configuration>
      <groups>!be.test.InjectTests</groups>
   </configuration>
</plugin>

I’d like to override the configuration in the command-line to run the Inject tests like this:

mvn clean install -Dgroups=be.test.InjectTests

But that doesnt work, the -Dgroups gets ignored by Maven.

If I don’t put the the command works fine.

  • 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-17T12:21:32+00:00Added an answer on June 17, 2026 at 12:21 pm

    Unfortunately it seems that if something is set in the pom it is not easily overridden (if you set skipTests explicitly it’d be hard to override with a property as well)… But! (and this is a bit of a hack) you can defer the setting of the property, to a pom property, and then override it on the command line.

    <project>
    ...
    <properties>
        <groups>!Slow</groups>
    <properties>
    ....
    <build>
        <plugins>
            ...
            <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-surefire-plugin</artifactId>
               <version>2.13</version>
               <configuration>
                <groups>${groups}</groups>
               </configuration>
            </plugin>
        </plugins>
    </build>
    ...
    

    With this (and a quick built out project, running on OSX, Maven 3.0.4, Java 1.6.0_37):

    $ mvn clean test
    ...
    Results :
    
    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
    ...
    $ mvn clean test -Dgroups=Slow
    ...
    Results :
    
    Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So right now my project has a few custom dialogs that do things like
I have a project that has a few dependencies on other Jars. I currently
I'm stepping in to a project that has been going on for a few
I have created a small flash CS4 project that has a few custom components
My project has a few xml templates that were modified and added to a
My small Web API project (hosted via SelfHostHttpServer ) has a few dependencies I
In a few MVC projects I've been working on, it has become apparent that
My project has some unit tests. They all depend on some external service, over
My Android project has a few jar libraries as dependencies. Alone, it compiles and
* Coded Edited with Fix * I found an open source project that has

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.