I want to edit A’s build.gradle with something along the lines of:
allprojects {
configurations {
mycompile
}
}
So in B and C I can use:
dependencies {
mycompile .......
}
This is so that when I am building an RPM in project A, I can filter the dependencies of each sub-project and include the “mycompile” dependencies with the RPM.
“mycompile” dependencies should also be resolved during build/compile as normal.
However, I keep getting an error:
Could not find method mycompile() for arguments []
I would really appreciate some support on this.
Thanks
That’s what I said And I also pointed out a better way to do dependsOn which doesn’t have this ordering problem. See the first part of my post above.
But again, this build can be greatly simplified and be made more robust with the change I suggested in the second part. Reaching into subprojects exposes you to all kinds of ordering problems. Using proper dependency declarations fixes that.
How does gradle know that in order to satisfy that dependency it has to make a jar from project foo? Why cant it assume that the dependency is a zip file from the distZip task?
When you call project('foo'), that’s a shorthand for project(name: 'foo', configuration: 'default'). The default configuration for a Java project includes the jar and the runtime dependencies for instance. But you can depend on any other configuration too.
So for instance if you do this in the subproject:
configurations {
dist
}
archives {
dist distZip
}
Then you can get the distZip by having a dependency on project(name: 'foo', configuration: 'dist')
What does archives here mean? What is this block?
In general, How do I associate any given set of generated files in the buildDir folder with a custom configuration?