Uploaded image for project: 'Gradle'
  1. Gradle
  2. GRADLE-1749

Provide support for optional dependencies and reflect in generated Maven metadata

    Details

    • Type: Improvement
    • Status: Resolved
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None

      Description

      Maven metadata allows for 'optional' dependencies, which is quite important for frameworks like Spring, where we must compile against certain artifacts, but use by end users is optional (i.e. if they don't use particular classes, they don't need the dependency).

      Ivy allows for expressing this, Maven allows for expressing this.

      What we need is something like:

          dependencies {
              compile "net.sourceforge.jopt-simple:joptsimple:3.0.0" {
                  optional = true
              }
          }
      

      And for that to be reflected in the generated pom.xml as:

                      <dependency>
                              <groupId>net.sourceforge.jopt-simple</groupId>
                              <artifactId>joptsimple</artifactId>
                              <scope>compile</scope>
                              <optional>true</optional>
                      </dependency>
      

      See also: http://gradle.1045684.n5.nabble.com/Marking-Maven-Dependencies-as-optional-td1432582.html

        Activity

        Hide
        sdavids13 Steve Davids added a comment -

        This ticket seems to be starving to death, I would think this would be resolved before adding the `compileOnly` dependency type. I would greatly appreciate this in multiple projects instead of just rolling with the basic `compile` dependency then ignoring the specific transitive dependencies that aren't actually necessary.

        Show
        sdavids13 Steve Davids added a comment - This ticket seems to be starving to death, I would think this would be resolved before adding the `compileOnly` dependency type. I would greatly appreciate this in multiple projects instead of just rolling with the basic `compile` dependency then ignoring the specific transitive dependencies that aren't actually necessary.
        Hide
        sdeleuze Sébastien Deleuze added a comment -

        Now that `compileOnly` is supported, could we have an update from the the Gradle team about this issue which has been created almost 5 years ago?

        Show
        sdeleuze Sébastien Deleuze added a comment - Now that `compileOnly` is supported, could we have an update from the the Gradle team about this issue which has been created almost 5 years ago?
        Hide
        bmuschko Benjamin Muschko added a comment -

        As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

        We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

        Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

        • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
        • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

        We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

        Show
        bmuschko Benjamin Muschko added a comment - As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub. We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to. Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by: Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines . Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete. We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!
        Hide
        dsmiley David Smiley added a comment - - edited

        Benjamin Muschko please also consider the top voted issues. This issue here is very popular.

        Show
        dsmiley David Smiley added a comment - - edited Benjamin Muschko please also consider the top voted issues. This issue here is very popular.
        Hide
        eriwen Eric Wendelin added a comment -
        Show
        eriwen Eric Wendelin added a comment - Moved to https://github.com/gradle/gradle/issues/867

          People

          • Assignee:
            Unassigned
            Reporter:
            cbeams Chris Beams
          • Votes:
            57 Vote for this issue
            Watchers:
            54 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development