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

Allow Dependencies from Provided and Other Configurations Into Resulting Artifact #31

Open
sghill opened this issue Feb 6, 2017 · 7 comments

Comments

@sghill
Copy link
Contributor

sghill commented Feb 6, 2017

If a dependency is declared as provided and another configuration that is included in resulting artifacts (such as compile or runtime), it should not remove the dependency from the artifact.

@quidryan
Copy link

quidryan commented Feb 7, 2017

Correct me if I'm wrong, this was on a web-app, where the provided configuration was created by the war plugin and not by the extra-configurations-plugins. Is this a core gradle bug?

@Helmsdown
Copy link

+1

@rspieldenner
Copy link
Contributor

rspieldenner commented Feb 9, 2017 via email

@Helmsdown
Copy link

Helmsdown commented Feb 10, 2017

The behavior I've seen is as follows:

  1. dependency X is a specified as a provided dependency of my build
  2. dependency X has transitive dependencies (A, B, and C)
  3. dependency Y is specified as a compile dependency of my build
  4. dependency Y has transitive dependencies (which include C)
  5. dependency C is NOT included in my war (even though it should be because Y depends on it)

@sghill @quidryan can you confirm if this matches what you have seen? if so, at the very least the documentation for "provided" should explicitly call this out. It seems to me that the transitive dependencies of Y should be included in my war, regardless of whether X happens to have transitive dependency overlap.

@rspieldenner
Copy link
Contributor

That is the behavior that our provided performs just like it is the behavior that providedCompile from the war plugin performs. You have told gradle that dependency X and all of its transitives will be provided, since why would X be provided by the system but not A, B, and C.

I would be happy erroring or warning on the build that you have specified something that can't be resolved.

@sghill
Copy link
Contributor Author

sghill commented Feb 11, 2017

Confirming this is how providedCompile, compileOnly, and provided work with this example project: https://github.com/sghill/gradle-configurations-war-example

@Helmsdown Yes, that matches what I have seen. I also like @rspieldenner's idea of erroring or warning on the build since this behavior is almost never what is intended.

There is another scenario that may need a new configuration:

  1. I depend on something I only want to use in development, like an embedded server
  2. My development dependency should not end up in the resulting artifact (ruling out compile)
  3. My development dependency must be available on the runtime classpath of the IDE. I also need the transitive dependencies that overlap with the development dependency to be included in the resulting artifact. (ruling out compileOnly and provided)

@qiangdavidliu
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants