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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:14:01+00:00 2026-05-12T23:14:01+00:00

I use maven to build a multi module project. My module 2 depends on

  • 0

I use maven to build a multi module project. My module 2 depends on Module 1 src at compile scope and module 1 tests in test scope.

Module 2 –

   <dependency>
       <groupId>blah</groupId>
       <artifactId>MODULE1</artifactId>
       <version>blah</version>
       <classifier>tests</classifier>
       <scope>test</scope>
   </dependency>

This works fine. Say my module 3 depends on Module1 src and tests at compile time.

Module 3 –

   <dependency>
       <groupId>blah</groupId>
       <artifactId>MODULE1</artifactId>
       <version>blah</version>
       <classifier>tests</classifier>
       <scope>compile</scope>
   </dependency>

When I run mvn clean install, my build runs till module 3, fails at module 3 as it couldn’t resolve the module 1 test dependency. Then I do a mvn install on module 3 alone, go back and run mvn install on my parent pom to make it build. How can I fix this?

  • 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-12T23:14:02+00:00Added an answer on May 12, 2026 at 11:14 pm

    I have a doubt about what you are trying to do but but I’ll assume you want to reuse the tests that you have created for a project (module1) in another. As explained in the note at the bottom of the Guide to using attached tests:

    Note that previous editions of this guide suggested to use <classifier>tests</classifier> instead of <type>test-jar</type>. While this currently works for some cases, it does not properly work during a reactor build of the test JAR module and any consumer if a lifecycle phase prior to install is invoked. In such a scenario, Maven will not resolve the test JAR from the output of the reactor build but from the local/remote repository. Apparently, the JAR from the repositories could be outdated or completely missing, causing a build failure (cf. MNG-2045).

    So, first, to package up compiled tests in a JAR and deploy them for general reuse, configure the maven-jar-plugin as follows:

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

    Then, install/deploy the test JAR artifact as usual (using mvn install or mvn deploy).

    Finally, to use the test JAR, you should specify a dependency with a specified type of test-jar:

    <project>
      ...
      <dependencies>
        <dependency>
          <groupId>com.myco.app</groupId>
          <artifactId>foo</artifactId>
          <version>1.0-SNAPSHOT</version>
          <type>test-jar</type>
          <scope>test</scope>
        </dependency>
      </dependencies>
      ...
    </project>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It seems there is no set_center method in the Map… May 13, 2026 at 1:59 am
  • Editorial Team
    Editorial Team added an answer When you state "Access Table Keyed" is this the same… May 13, 2026 at 1:59 am
  • Editorial Team
    Editorial Team added an answer You're not including the file with your ATableModel definition. <?php… May 13, 2026 at 1:59 am

Related Questions

I have a multi-module maven project with an installer sub-project. The installer will be
I have been struggling to get Maven2 to cooperate with me, and was wondering
I have a multi-module (maven) spring build. All the modules publish some beans, and
I am trying to use maven to build a project that depends on a
I've been trying to use Maven to build a project. The project builds fine

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.