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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:31:18+00:00 2026-06-01T17:31:18+00:00

I have the default src/test/java folder for our unit tests. A separate folder src/integration/java

  • 0

I have the default src/test/java folder for our unit tests. A separate folder src/integration/java is available for the integration tests.

I configured the maven-surefire-plugin to execute the unit/integration tests in their respective phases. This works great when the compiled classes are in the correct directory. Unfortunately Maven only supports one test source folder and one test output folder.

With mavens build-helper plugin I could add another test-source folder but the compiled classes will be generated into test-classes but I want to compile the classes from src/integration/java into target/integration-test-classes. Is this possible?

src/test/java > target/test-classes
src/integration/java > target/integration-test-classes

PS: I don’t like this exclude/include on package base solution (exclude all **/it/** files from the default test phase, and exclude all **/unit/** from the integration phase.

  • 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-01T17:31:19+00:00Added an answer on June 1, 2026 at 5:31 pm

    Sorry, there’s no way of doing that, even when considering some hacking. The concept here is there’s only one target directory for compiled classes and one for compiled test classes (even the single <build> tag exposes this). To be honest, I don’t really think it should be possible with Maven. Maven promotes straight, clean and legible design of your application, by using well-crafted modules.

    I think that what you really want to do is actually to create the integration tests module. That’s the common practice, by the way. So far I’ve always had separate integration testing module and never have had any problems with it. You should depend on all modules needed to run these tests. You can even depend on other module’s test classes by using <type>test-jar</type> within your dependency declaration, as mentioned here:

    http://maven.apache.org/guides/mini/guide-attached-tests.html

    I don’t like this method, however, and usually prefer to have separate module with testing support stuff, like base classes for JUnit test cases etc.

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

Sidebar

Related Questions

Most of our Eclipse projects have multiple source folders, for example: src/main/java src/test/java When
I'm unable to adjust java logging's logging level. I'm using maven surefire (mvn test),
I have a simple java maven project. One of my classes when executing needs
I have several session beans that I have written unit tests for. I have
I have a maven program, it compiles fine. When I run mvn test it
I have two source folders, src and test . The Quick JUnit plugin allows
It is a JSP application. Under /WEB-INF/src I have A.java and B.java, both in
I have a java project which includes settings, bin, src, .classpath, .project. I am
I have a properties file that I currently have in this folder: /src/webapp/WEB-INF/classes/my.properties I
My server have default php version of 4, so when I run some script

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.