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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:08:23+00:00 2026-05-27T06:08:23+00:00

I develop a little java utility library using maven. Now I’d like to add

  • 0

I develop a little java utility library using maven. Now I’d like to add some demo / sample code to show how to use the library.

Where is the best place to put it?

  • In a sub-package with the other code. I don’t like this since it means the demos will be included in the library jar file.

  • In a new maven artifact. That works, but I’d prever to have the demos closer connected to the library source.

  • As a sub-artifact. Haven’t tried this yet. Seems to make everything a bit complex for something that should be simple.

Is there any common pattern to do 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-27T06:08:23+00:00Added an answer on May 27, 2026 at 6:08 am

    If it’s some sample code snippets that run by themselves and just demonstrate how to use the library, then write them as unit tests, in the same module.

    If it’s more like a separate demo application (that a user might even interact with), then create a separate artifact. It’s the standard way of doing it. If you really want to you could put it in the same module, but in a different source directory, but that’s just making it harder on yourself.

    Your library and you demo should probably share a parent module (of type “pom”, not “jar” like the others), giving you a multi-module project. Then you can build both by launching maven from this parent module.

    If you want to release your library and demo together (you can, but you don’t have to), you can do that from the parent too.

    In other words, it’s not because they are separate modules, packaged in different artifacts, that they cannot be closely connected anymore. The different modules of a multi-module project still form one whole project.

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

Sidebar

Related Questions

I'd like to develop a little application which lets user automatically add their own
I'm done some WinForms work in C# but now moving to have to develop
I try to develop my own little framework. For this, I'd like to read
I develop Java code with Eclipse and regularly get this message: resource is out
I've been assigned to develop a small Java application to process some data from
I've been trying to develop a little library for reading MPQ files in Clojure,
I have been challenged by a professor to develop a little Bluetooth Demo app
I'm a newbie to Cocoa, just develop some little apps with C/C++ on Windows.
I typically use Netbeans (but also STS) to develop my Java code but I've
I want to develop a little iPhone application, just for my personal needs. I

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.