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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:58:48+00:00 2026-05-14T05:58:48+00:00

I googled this and it seems that no one has an answer, yet it

  • 0

I googled this and it seems that no one has an answer, yet it seems like such an elementary thing that it should be possible.

I have the following project structure:

parent
   ---sub-project1
   ---sub-project2

sub-project2 needs to have sub-project1 as a dependency.

So I have this in sub-project2’s pom:

 <dependencies>
    <dependency>
         <artifactId>sub-project1</artifactId>
        <groupId>mygroup</groupId>
        <version>1.0-SNAPSHOT</version>
    </dependency>

….

When I do this, Maven tries to dowload the sub-project1.jar file, which does not exist because it’s not ready for the repo yet.

I tried to put a <scope>import</scope> in the dependency, but that didn’t work either — same result.

So what do I have to do to get Maven to look at sub-project1 when building sub-project2?

EDIT Here are some pom snippets:

Parent:

<project 
   xmlns="http://maven.apache.org/POM/4.0.0" 
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0          
    http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <prerequisites>
      <maven>2.0.9</maven>
   </prerequisites>
   <modules>
    <module>sub-project1</module>
    <module>sub-project2</module>
   </modules>
 ....

sub-project1:

<project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <parent>
    <artifactId>parent</artifactId>
    <groupId>mygroup</groupId>
    <version>1.0-SNAPSHOT</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>

  <artifactId>sub-project1</artifactId>
....

sub-project2:

<project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <parent>
    <artifactId>parent</artifactId>
    <groupId>mygroup</groupId>
    <version>1.0-SNAPSHOT</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>

   <artifactId>sub-project1</artifactId>

    <dependencies>
     ....
       <dependency>
          <artifactId>sub-project2</artifactId>
          <groupId>mygroup</groupId>
          <version>1.0-SNAPSHOT</version>
          <scope>import</scope>
      </dependency>
  </dependencies>

The error I’m getting when I got mvn clean install on the parent is:

[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure

With a lot of classes/package not found errors

  • 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-14T05:58:49+00:00Added an answer on May 14, 2026 at 5:58 am

    You should have a master pom at parent’s level, in which you will list the modules of your project.

      <modules>
        <module>sub-project1</module>
        <module>sub-project2</module>>
      </modules>
    

    In each subproject you have to reference your parent:

    <parent>
        <artifactId>parent</artifactId>
        <groupId>mygroup</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    

    And you specify the dependencies between the project just as you did. I think you’ve missed some of the steps I’ve described.

    Edit: you should issue your mvn clean install at the parent level.

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

Sidebar

Related Questions

This seems like a trivial thing, but one of the biggest slowdowns in my
I have looked for solutions to this on google for what seems like an
I have googled this a little and didn't really find the answer I needed.
I am new to Emacs. I have googled this but no good answer there.
This seems like it should be simple, but I'm new to CakePHP. Maybe it's
I have a web application written in Django that has one specific page I'd
Has anyone actually succeeded in doing this it seems like there are so many
I have another SQL/access 2007 question that seems really basic but I'm not sure
I can see this question (or a similar one) has been asked a few
I've tried googling for a solution to this problem but haven't yet found one.

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.