Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency resolution of Ivy artifacts does not support [type] token #1386

Closed
frisby opened this issue Feb 10, 2017 · 4 comments
Closed

Dependency resolution of Ivy artifacts does not support [type] token #1386

frisby opened this issue Feb 10, 2017 · 4 comments
Labels
a:feature A new functionality stale

Comments

@frisby
Copy link

frisby commented Feb 10, 2017

Summary

There should be a way to customize every element of an Ivy artifact pattern. It appears that there is no way to specify a [type] that does not match [ext].

Context

Sample Ivy layout pattern, taken from the Gradle 3.3 User Guide:

repositories {
    ivy {
        url "http://repo.mycompany.com/repo"
        layout "pattern", {
            artifact "[module]/[revision]/[type]/[artifact].[ext]"
        }
    }
}

Fairly typical external dependency, also from the Gradle 3.3 User Guide:

dependencies {
    compile group: 'org.hibernate', name: 'hibernate-core', version: '3.6.7.Final'
}

(apply plugin: 'java' was specified in a previous Example, and presumed to remain in effect.)

In the above example, compile's group: parameter maps to [module], name: to [artifact], and version: to [revision]. Although I can find no documentation for it, the compile command appears to support ext:, which maps to Ivy's [ext] token.

Current Behavior

As near as I can tell, Gradle forces [type] to match [ext]. While very common, this is not guaranteed, which is why they are separate tokens to begin with.

Expected Behavior

There should be a way, either inline or via closure, to let [type] and [ext] operate independently of one another. Because they usually match, a default in which they are equal is fine.

In researching this, I've seen a few people draw comparisons to Maven's classifier. In these online discussions, Gradle developers have resisted this comparison, for reasons I presume are valid (this is not my area of expertise). Nevertheless, the [type] token should have some mechanism of support.

Steps to Reproduce (for bugs)

Using the examples above, an Ivy repository with the following directory layout should be sufficient to reproduce:

org.hibernate/
  |
  +--3.6.7.Final/
      |
      +--bin/
      |    |
      |    +--hibernate-core.jar
      |
      +--src/
           |
           +--hibernate-core.jar

The expectation would be that Hibernate's binary file would have a [type] of 'bin', while the source code would have a [type] of 'src'. The goal is to specify an external dependency that lets one download either .jar using the Ivy pattern in Gradle's User Guide.

(The only workaround I can see right now is to create separate patterns with each value for [type] hard-coded into it. This not only misses the point of having a token, it forces a download of every .jar, instead of "just sources" or "just binaries".)

I saw that the incubating IvyArtifact class has a type property, but it appears to be publish-only. I cannot find an equivalent concept for dependencies.

Your Environment

I am currently a developer working at a large enterprise with a strong division of roles between developers and operations. My access to the Ivy repository is restricted to an "end-user" role, so altering its configuration is not an option.

@eriwen
Copy link
Contributor

eriwen commented Feb 10, 2017

Thank you very much for a thorough feature request @frisby. It sounds like you dug into the code here, would you be willing and able to submit a PR to address this? I believe it will ship to users like yourself faster.

@eriwen eriwen added a:feature A new functionality from:contributor labels Feb 10, 2017
@eriwen
Copy link
Contributor

eriwen commented Feb 10, 2017

Note that this seems closely related to #1357. A contributor could make a very big impact by addressing both changes.

@stale
Copy link

stale bot commented Feb 17, 2021

This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. If you're interested in how we try to keep the backlog in a healthy state, please read our blog post on how we refine our backlog. If you feel this is something you could contribute, please have a look at our Contributor Guide. Thank you for your contribution.

@stale stale bot added the stale label Feb 17, 2021
@stale
Copy link

stale bot commented Mar 10, 2021

This issue has been automatically closed due to inactivity. If you can reproduce this on a recent version of Gradle or if you have a good use case for this feature, please feel free to reopen the issue with steps to reproduce, a quick explanation of your use case or a high-quality pull request.

@stale stale bot closed this as completed Mar 10, 2021
@wolfs wolfs closed this as not planned Won't fix, can't repro, duplicate, stale Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:feature A new functionality stale
Projects
None yet
Development

No branches or pull requests

7 participants