[GRADLE-1913] Iterating over runtime dependencies of a project unless a required project has been built, makes the required project JAR not being shown as a dependency Created: 10/Nov/11 Updated: 18/Jan/17 Resolved: 16/Jan/17 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | 1.0-milestone-5 |
Fix Version/s: | None |
Type: | Bug | ||
Reporter: | Mauro Molinari | Assignee: | Unassigned |
Resolution: | Won't Fix | Votes: | 1 |
Attachments: | GRADLE-1913.zip |
Description |
I don't know if this is really a problem in the actual build process, but it might be when you want to do some debugging or you need to do some special process based on dependencies. Consider the attached multiproject. Examples: run "gradle clean war printDeps" and "gradle clean printDeps" from the root project and see the differences. I think this is misleading: even if B.jar does not yet exist, it may be built by subsequent actions, if required. In any case, A has a runtime dependency on B, so it should be present in A runtime configuration. |
Comments |
Comment by Benjamin Muschko [ 15/Nov/16 ] |
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:
We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle! |
Comment by Mauro Molinari [ 15/Nov/16 ] |
This is still reproducible in recent Gradle. |
Comment by Benjamin Muschko [ 16/Jan/17 ] |
I am not quite sure why you used fileTree for iterating over the runtime dependencies. Either way, the following works in both cases:
task printDeps << {
println "Printing ${name} dependencies:"
configurations.runtime.each {
println it
}
}
|
Comment by Mauro Molinari [ 17/Jan/17 ] |
Well, I can ask you why I should not! Anyway, a long time has passed and this was just a sample to reproduce the problem. What I think I was trying to achieve was to copy all the JARs a project depended on to a target folder. |
Comment by Benjamin Muschko [ 17/Jan/17 ] |
If you ask for the FileTree then you are only getting the root folder but not the actual files. You'd either have to call the method getFiles() to get the flattened list or iterate over the files with the method visit. I think the documentation is fairly clear about though I can see how you could miss those details. |
Comment by Mauro Molinari [ 18/Jan/17 ] |
I am of course iterating over the files (see the sample project), the problem is that the B.jar is not among the dependency files if B has not yet been built, like if it were not a dependency. |