-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
No dependency substitution happens for Version Catalogs included as separate build #18847
Comments
Is there any workaround I can try? |
This isn't a bug but a consequence of the design. The The workaround is easy: instead of using a |
Thanks for the information. includeBuild("plugin-version-catalog")
dependencyResolutionManagement {
versionCatalogs {
libs {
from("g:plugin-version-catalog:v")
}
}
} And I got this error: Could not resolve all artifacts for configuration 'incomingCatalogForLibs0'.
> Could not find g:plugin-version-catalog:v.
Searched in the following locations:
...
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html So no dependency substitution happened. Am I missing something? |
mmm, no you're correct, I thought the substitution would automatically apply but it's not the case. |
So should I close this very issue and create new one describing the substitution problem with composite build? |
I would appreciate it if you could simply edit this one to describe the correct issue with included builds, I was planning to have this same discussion and use this ticket if that bug existed. |
The ticket is updated. Thank you for your help. |
@little-fish i got mine working. when you have multiple included builds, the order in the |
Facing the same issue.. Im using gradle 7.2. Any workaround for this? |
@big-guy i see milestone for this is 8.0 RC1/ 8.1 RC1 which is way long. Is there any work around for now in 7.2 or above versions? bcoz everytime publishing to artifactory and then using it is cumbersome. |
I fixed my issue by renaming the published catalog artifact from Producer: //build.gradle.kts
publishing {
publications {
register<MavenPublication>("catalog") {
from(components["versionCatalog"])
group = "com.org"
artifactId = "versioncatalog" //renamed from version-catalog
version = "1.0"
}
}
repositories { ... }
}
Consumer: //settings.gradle.kts
dependencyResolutionManagement {
repositories { .. }
versionCatalogs {
create("libs").from("com.org:versioncatalog:1.0")
// fails with "Could not resolve all artifacts for configuration 'incomingCatalogForLibs0'."
// create("libs").from("com.org:version-catalog:1.0")
} More context
Edit 1
|
Tried with 8.0 RC2 but problem remain. Using
does not substitute the one pointed out from settings.gradle
|
Any news on this one? I'm using the Setting API to generate the catalog:
but still no dependency substitution takes place.. |
Same with 8.4 |
I know its not the best solution, but works as a workaround, temporary!
|
still facing issue with gradle version-8.5 |
I see why it is happening. In module file the versionCatalogElements variant is missing. Most of the time when i publish i see apiElements and runtimeElements variants not versionCatalogElements. |
You probably publish the |
I tried with java it is same. With java the mavenPublishLocal is setting variant as Currently with versionCatalog and mavenPublishLocal works good. I think the issue is with Jfrog publish which ignores the versionCatalog which holds Created a issue: Not sure it is gradle issue or jfrog plugin issue. |
Sure, you did the opposite of what I said.
Quite possible, I often heard of strange things in their plugin. |
@Vampire Do you have any sample how can we use |
Nope, sorry, never used Artifactory, but I know that multiple people were pretty happy to just use |
When using composite build and including Version Catalogs plugin project, no dependency substitution happens.
Expected Behavior
Dependency specified with GAV should be substituted with included build.
Current Behavior
settings.gradle:
version-catalog/build.gradle:
Following exception is thrown:
Context
We have multiple SCM repositories within our department.
core
for shared libraries andimpl
ones which depends oncore
.Within the
core
library we want to have aversion-catalog
plugin which can be used withincore
repo itself (as an included build) and withinimpl
repositories (with composition builds enabled/disabled).Your Environment
Gradle 7.2.
The text was updated successfully, but these errors were encountered: