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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:34:50+00:00 2026-05-26T00:34:50+00:00

I have a project that includes some Java APIs, some resource files, and some

  • 0

I have a project that includes some Java APIs, some resource files, and some pre-built machine learning models that can be used by the Java APIs. The models are currently in src/main/resources and the classes load them via Class.getResource. The models are used in several unit tests that make sure the APIs work as expected.

This is all basically fine, except that the models are quite large, and some users of the APIs may not need the models at all. (They’d just need the Java classes and the other smaller resource files.) So I’d like to arrange a distribution where users could choose to include the model files or not.

At first I thought that maybe the models should be a separate Maven project of their own, but if I pulled them out, I’m not sure how the dependencies would work. The models project would have to depend on the primary project for the Java APIs, but the primary project would have to depend on the models project for its tests. So that seems circular.

Then I thought that maybe I should be trying to create a separate jar with a classifier so that, e.g. users that need only the APIs would write:

<dependency>
    <groupId>foo</groupId>
    <artifactId>bar</artifactId>
    <version>0.5.0</version>
</dependency>

and users who wanted both the APIs and the models would write:

<dependency>
    <groupId>foo</groupId>
    <artifactId>bar</artifactId>
    <version>0.5.0</version>
</dependency>
<dependency>
    <groupId>foo</groupId>
    <artifactId>bar</artifactId>
    <version>0.5.0</version>
    <classifier>models</classifier>
</dependency>

But I’m not sure how to set things up so that when I run mvn package some resources get separated out into a jar with a different classifier. How can I do that?

(Ideally, this would all happen with just the basic mvn package and would not require futzing around with, say, different profiles, since I would always be packaging things the same way.)

  • 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-26T00:34:51+00:00Added an answer on May 26, 2026 at 12:34 am

    Given these points…

    • You want your API and pre-built models to be separately deliverable artifacts.
    • Theoretically, users of your API could provide their own models.
    • You test your API with the pre-built deliverable models.

    I believe the problem is that you are using the deliverable models for unit testing.

    I recommend you do the following:

    • Create a separate maven module for the models as you were initially inclined to do. They would be in src/main/resources of the new module. Your API module would no longer have models in src/main/resources.
    • In the API module, create some simpler models designed solely for unit testing and place them in src/test/resources. Make them as minimalist as possible to test the API functionality. Re-write your API unit tests to use those instead. As a starting point you could make a copy of the deliverable models and place them here, but I recommend a smaller set of test data that has examples of each kind of thing a model can contain.
    • If you want to test you have correctly authored your pre-built models, have the new model module depend on the API module, and write unit tests for the pre-built models in the model module.

    That leaves you with no module cycles, models separate from API, unit tests for the API, and optionally unit tests for the deliverable models.

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

Sidebar

Related Questions

I have an Android (Java) project that includes some native C/C++ code and I
I have inherited a Java project which includes a number of classes that are
I have a project that includes a copy of phpMyAdmin. I do development locally
I have a very old project that includes the source from another project directly,
I have a project that has the following line in the additional includes section:
I have a visual studio 2008 solution that includes an asp.net-hosted remoting project in
I'm new to Java, and have set myself a project to write so that
I have a Java project that currently has a lot of JARs in its
I have a Java/Spring MVC/JSP/JSTL webapp. We have a designer that gave us some
I have an Android java library that uses some native code. I have added

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.