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

Provide support for optional dependencies and reflect in generated Maven metadata

    XMLWordPrintable

    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

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: