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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:07:32+00:00 2026-05-18T08:07:32+00:00

I have 2 maven projects, one for the sources: ProjSource , containing one class:

  • 0

I have 2 maven projects, one for the sources: ProjSource, containing one class: Class-A.. and another one: ProjTest containing a test class for Class-A named Class-A-Test .
I want my test class to be run when I call an mvn:install on ProjSource.

What is the simplest way to perform such thing? note that my experience with unit tests is very basic.. I don’t know how to tell Maven that Class-A-Test is designed to test Class-A..

I followed the steps described using the maven-jar-plugin with test-jar Goal here and defining the resulting *******-tests.jar as a dependency for ProjSource with:

<type>test-jar</type>
<scope>test</scope>

but when i run an mvn:install, the output says that: “There are no tests to run”. Have I missed something ?

Any help is highly appreciable, and many thanks in advance !

Regards,

  • 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-18T08:07:32+00:00Added an answer on May 18, 2026 at 8:07 am
    1. don’t do it that way. The maven way to do it is to have standard sources under src/main/java and test sources under src/test/java. By default, standard sources will be added to the resulting JAR, while tests in the test source dir will be executed automatically. This is well-tested behavior, why change it? If you want / need a test jar, call jar:test-jar in the pom.xml of this project and use the buildhelper plugin to attach the resulting artifact for deploy. That way you can keep the standard project layout and still have a test jar.

    2. if you insist on doing it, you would have to do it the other way around. The test project would have to have a dependency to the main project (you can’t test what you don’t know). I would suggest to just put the test code in src/test/java in the test project, then maven’s magic can work the default way. Insert bold text from above here, too.

    But the reason why the maven lifecycle was defined as it was is that failed tests are supposed to fail the build. There is no point in building a library that doesn’t do what it’s supposed to do.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have imported some projects in eclipse through Maven. I want to access the
I have two maven-based eclipse projects, one being a project with common classes and
I have a web app that depends on multiple internal maven projects, can one
I have a multimodule Maven project. One subproject hosts XSL/XML resource files. The other
I have the same problem as Junit4 and TestNG in one project with Maven
I have several Maven projects in eclipse that depends on each other. Some of
I have 3 maven projects WebComponents DataComponents ServiceComponents When i build each of the
I have worked on maven projects in which the directory structure looks like: src/
I have this maven multi-project configuration with a parent project and three child projects:
Let's say I have two maven profiles for running projects web tests: 1. first

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.