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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:24:28+00:00 2026-06-11T02:24:28+00:00

Recently I wrote a project with maven, but I have a question about the

  • 0

Recently I wrote a project with maven, but I have a question about the version in maven pom.xml.

If I write such a dependency

<dependency>
    <groupId>foo</groupId>
    <artifactId>bar</artifactId>
     <!--No version here-->
</dependency>

what will the version be

  1. in a simple project, no subproject

  2. as a dependency in another project and that project use foo-bar-1.0.0

  • 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-06-11T02:24:30+00:00Added an answer on June 11, 2026 at 2:24 am

    Part 1. of your question: If you don’t specify a version there are various different outcomes:

    a) you will get an error…

    [ERROR]   The project org.example:myproject:0.5-SNAPSHOT (D:\src\myproject\pom.xml) has 1 error
    [ERROR]     'dependencies.dependency.version' for foo:bar:jar is missing. @ line 39, column 14
    

    b) if you have defined the version in the dependency management of the project’s parent’s pom, then that version is taken. The parent of the project doesn’t have to be an enclosing superproject. It can simply be a collection of appropriate definitions.

    c) if another dependency of your project also depends on foo:bar, and specifies a version, then that version is taken. Maven 2 has a mechanism called transitive dependencies. If the version of a dependency is not explicitly specified for an artifact, it searches the dependency tree and uses the nearest definition in the tree. If there are two nearest definitions, then the first declaration wins (since maven 2.0.9).

    Part 2.: I am not sure, but maybe the transitive dependency mechanism also works that way. But the documentation (as far as I understood it) doesn’t mention that case.

    But somehow I feel that the second part of your question doesn’t make sense: I guess that in order to use an artifact as a dependency, you would have to build it first. So you’d have to know the version of the dependencies well before it is used as a dependency itself.

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

Sidebar

Related Questions

In my job project I have recently been asked to generate POM files via
I recently found out about C# extension methods and wrote this one: /// <summary>
I have a rather confusing issue. I've recently picked up some code I wrote
I have come to something of a crossroads. I recently wrote a 10,000 line
We have a massive client facing web application here. We recently re-wrote the buy
I've recently been given a chance to write a simple tcp-client for a project
I have recently begun a new project which runs on remote computer. I usually
I recently wrote a Java playing card game and have all the game logic
Recently, I wrote a simple web application. I currently have. A static page which
I recently created a Windows application project using C#. I have completed all the

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.