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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:21:31+00:00 2026-05-22T14:21:31+00:00

I am using a local repository as described in Maven: add a dependency to

  • 0

I am using a local repository as described in Maven: add a dependency to a jar by relative path.

The repository-url is defined in the topmost pom.xml as

<url>file:${basedir}/../3rdParty/maven-repository</url>

Also, the topmost pom.xml defines 2 modules

<modules>
    <module>sub1</module>
    <module>sub2</module>
</modules>

The problem is, that if a module (say sub1) defines a dependency that should be downloaded from the repository, and maven is called from the topmost directory, the ${basedir} is not set to this directory, but to sub1, resulting in a wrong repository-URL.

So, say the project with the topmost pom.xml resides in

/Development/myproject/pom.xml

And the repository is in

/Development/3rdParty/maven-repository

Then the repository URL should be set to

/Development/myproject/../3rdParty/maven-repository

but it turns out it is set to

/Development/myproject/sub1/../3rdParty/maven-repository

which of course does not exist.

Any idea why that is the case?

  • 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-22T14:21:32+00:00Added an answer on May 22, 2026 at 2:21 pm

    Although it is annoying in your case, this is well-known and intentional. A maven project should know about its execution directory only, no matter in what context it is executed.

    I asked almost the same question: Maven variable for reactor root earlier, and the only answer that made sense was to use ${user.dir}, although it’s hacky and will not work if you build from a module directory.

    (There is also this very verbose solution: Maven2 property that indicates the parent directory)

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

Sidebar

Related Questions

Is it possible to set local repository path using profiles in Maven?
I am using a local maven repository to house some code I am using
I'm trying to convert a local SVN repository to git using git-svn under cygwin
I have a remote tracking branch tracked locally in my local repository using 'git
Using Git or Mercurial, if the working directory is 1GB, then the local repository
I have created a local repository and its URL is file:///F:/subversion/MyProject And I checked
I'm using a local Git project repository, and have created a remote repository followed
I've been using Tortoise SVN (and VisualSVN) with a local repository on my desktop
I created a local repository using tortoiseSVN a while back. Now I would like
in our company we're using a local nexus repository. If I now try to

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.