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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:10:19+00:00 2026-05-16T16:10:19+00:00

I make use of dependency POMs which I will then go and include into

  • 0

I make use of dependency POMs which I will then go and include into another projects as as dependency. The problem I am having is while it aggregates the POM with those dependencies, it appears when I declare dependencies of scope, provided, those aren’t included.

Is it possible to include provided dependencies in dependency POMs with a scope of provided? I often declare what APIs I need and then include the implementation as a runtime dependency.

  • 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-16T16:10:20+00:00Added an answer on May 16, 2026 at 4:10 pm

    If a dependency is provided why can’t that dependency be inherited with the same scope so I don’t have to declare it?

    It is inherited with the same scope. Given the following parent pom.xml:

    <project>
      <modelVersion>4.0.0</modelVersion>
      <groupId>com.stackoverflow.Q3597684</groupId>
      <artifactId>root</artifactId>
      <version>1.0-SNAPSHOT</version>
      <name>Q3597684 - Root</name>
      <packaging>pom</packaging>
      <dependencies>
        <dependency>
          <groupId>javax.servlet</groupId>
          <artifactId>servlet-api</artifactId>
          <version>2.5</version>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>3.8.1</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </project>
    

    And the following pom.xml that inherits from the root artifact:

    <project>
      <modelVersion>4.0.0</modelVersion>
      <parent>
        <artifactId>root</artifactId>
        <groupId>com.stackoverflow.Q3597684</groupId>
        <version>1.0-SNAPSHOT</version>
      </parent>
      <artifactId>child</artifactId>
      <packaging>war</packaging>
      <name>Q3597684 - Child</name>
      <dependencies/>
    </project>
    

    Running mvn dependency:tree from the child gives the following output:

    $ mvn dependency:tree[INFO] Scanning for projects...
    [INFO] Searching repository for plugin with prefix: 'dependency'.
    [INFO] ------------------------------------------------------------------------
    [INFO] Building Q3597684 - Child
    [INFO]    task-segment: [dependency:tree]
    [INFO] ------------------------------------------------------------------------
    [INFO] [dependency:tree {execution: default-cli}]
    [INFO] com.stackoverflow.Q3597684:child:war:1.0-SNAPSHOT
    [INFO] +- javax.servlet:servlet-api:jar:2.5:provided
    [INFO] \- junit:junit:jar:3.8.1:test
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESSFUL
    [INFO] ------------------------------------------------------------------------
    

    The provided servlet-api is there, as expected.

    Are you maybe (mis)using the dependencyManagement section?

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

Sidebar

Related Questions

I am trying to use dependency injection with WCF REST (WebGet) and am having
I'm having trouble designing classes to best make use of DI / IoC principles,
I'm having trouble with trying to use make to place object files in a
I have a asp.net mvc web site where I make use of the Dependency
I make use of the Mydac components by devart (corelab) to access MySql from
We make use of views and panels quite often in Drupal and a lot
I make use of generic views and I am attempting to query my MySQL
I'm trying to make use of the results attribute of HTML5 <input type=search> tags
I frequently make use of Request.QueryString[] variables. In my Page_load I often do things
Our application used to make use of a common base form that all forms

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.