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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:45:21+00:00 2026-05-13T19:45:21+00:00

Imagine a maven project with 3 modules, an interface module and two different implementations

  • 0

Imagine a maven project with 3 modules, an interface module and two different implementations of this interface in a module each.
I could test each implementation in its own module, but the test cases are basically the same, because of the same interface.

Is there a way to collect the test cases in a fourth maven module and test the two implementations with this module?

parent
|-interface
|-impl a
|-impl b
|-tests

So that if I build impl a, maven knows to run the tests from the tests module against the impl a build.

Thank you.

  • 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-13T19:45:22+00:00Added an answer on May 13, 2026 at 7:45 pm

    Regarding Java:

    What about creating an abstract test in the tests module, where you will write the main tests cases. This test will use the interface defined in the first module in the test.

    Then, in each module impl a and impl b, you create a test that extends the abstract test and call the test methods defined in the tests module.

    Regarding Maven :

    In the tests module, you will have to indicate to Maven that he has to create a jar of the tests package:

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.3</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
    

    Then, in each implementing module, you will have to indicate that you have a dependency to this test-jar library:

        <dependency>
            <groupId>foo</groupId>
            <artifactId>bar</artifactId>
            <version>${pom.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 313k
  • Answers 313k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Not a programming solution - but airfoil with airfoil speakers… May 13, 2026 at 10:47 pm
  • Editorial Team
    Editorial Team added an answer You could do something like this, a bit hacky though,… May 13, 2026 at 10:47 pm
  • Editorial Team
    Editorial Team added an answer Try this one: $withoutExt = preg_replace('/\.\w+$/', '', $filename); So, this… May 13, 2026 at 10:47 pm

Related Questions

Currently we have a project with a standard subversion repository layout of: ./trunk ./branches
Imagine following scenario: We have a lot of parallel development going on in several
I am relatively new to the world of Java and Maven, but I couldn't
I've been searching high and low for an Eclipse feature that lets you right-click
I'm developing on the standard Lift platform (maven and jetty). I'm repeatedly (once every

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.