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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:45:16+00:00 2026-05-12T16:45:16+00:00

I probably sholdn’t obsess about this too much, but my project has a very

  • 0

I probably sholdn’t obsess about this too much, but my project has a very structured layout that I have become very fond of. Having that much structure has actually proven to be useful, this time, so I don’t really want it to become messy again.

To start with, each module consists of several Java packages:

com.mycompany.mysoftware.modulename
com.mycompany.mysoftware.modulename.impl
com.mycompany.mysoftware.modulename.osgi
com.mycompany.mysoftware.modulename.test

The main code lives in .impl. Interfaces, some enums and some data container classes that are used by other modules live in the package with no suffix. There’s OSGi specific code (BundleActivators etc.) in the .osgi package and unit tests in the .test package.

Now I have classes that fake a module to be used in testing others. I’m wondering whether I should put those in the .test package of a common module that already contains shared libraries for the main code, or whether I should have a new module test that I can set up a different dependency scope for in Maven.

ETA: One problem I’m having is that I get circular dependencies: if I have two modules and the unit tests in each require a fake of the other, the module containing the fake has a dependency on the module containing the interface, which is the same module that contains the unit test. So, the fake should be together with the test, but that leads to a lot of code duplication. Or, for each module I make a fake module, but that makes me feel it’s getting out of hand…

  • 1 1 Answer
  • 1 View
  • 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-12T16:45:16+00:00Added an answer on May 12, 2026 at 4:45 pm

    You don’t want your testing code to be packaged in the common module used by main code, do you?

    So the answer seems obvious to me: create a test module and use it as dependency with a test scope.

    (EDIT: I’m putting an answer to the problem mentioned in the update of the question below)

    Regarding the circular dependencies, what about putting the interfaces in a separated module?

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

Sidebar

Related Questions

Okay, so I probably shouldn't be worrying about this anyway, but I've got some
Probably really easy for a pro, but could someone re-write this from it's PHP
Probably it has been asked before but I cannot find an answer. Table Data
This might be impossible to answer since there are probably too many variables here,
This is probably a silly and easy question, but it seems sometimes the simplest
Yes, this probably shouldn't bug me. But it does!! Why does XML have such
This is probably more of a usability question but this seems like a good
Okey, so the question has probably been asked before, but I haven't found an
this is probably really easy, but here goes: My changes to the magento email
This is probably a pretty dumb question, but earlier today I ran into some

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.