Colton Idle
11/19/2025, 4:32 PMversionCatalogs { create("lib") { from(mysubmoduledir/the.toml )}}
then it builds (hooray), but then if I try to add a toml in my actual projects gradle folder then I get an error
"You can only call the 'from' method a single time." Ideas?Vampire
11/19/2025, 4:43 PMgradle/libs.verisons.toml file in the project where you get the error?
Then Gradle does one of the calls with that file automatically so you have two from "calls", even if you only see one.Colton Idle
11/19/2025, 4:44 PMDo you also have the conventionalYeah, that's what I meant by "but then if I try to add a toml in my actual projects gradle folder then I get an error"file in the project where you get the error?gradle/libs.verisons.toml
Vampire
11/19/2025, 4:44 PMVampire
11/19/2025, 4:44 PMColton Idle
11/19/2025, 4:45 PMversionCatalogs {
create("libs") { from(files("mysubmodule", "gradle/libs.versions.toml")) }
}Vampire
11/19/2025, 4:45 PMColton Idle
11/19/2025, 4:46 PMVampire
11/19/2025, 4:46 PMVampire
11/19/2025, 4:46 PMVampire
11/19/2025, 4:47 PMColton Idle
11/19/2025, 4:47 PMVampire
11/19/2025, 4:47 PMlib, so you would have lib... for the submodule catalog, libs... for your ownColton Idle
11/19/2025, 4:47 PMActually what you had in your original post did that, but that is just a typodamnit. i was trying to save typing (cant copy pasta from company laptop, lol)
Vampire
11/19/2025, 4:47 PMlibs there or you would not have get that errorTrevJonez
11/19/2025, 4:48 PMVampire
11/19/2025, 4:48 PMversionCatalogs {
create("submoduleLibs") { from(mysubmoduledir/the.toml) }
}
and you are fineVampire
11/19/2025, 4:49 PMyou might also try a symlink? so both project just point to the same fileIt is unlikely that this will work, if it were the same content, he wouldn't need to have both, but only one would be fine
Vampire
11/19/2025, 4:49 PMColton Idle
11/19/2025, 4:49 PMVampire
11/19/2025, 4:50 PMso id prefer not to rename the submodule's toml file.I did not say you should
Vampire
11/19/2025, 4:50 PMVampire
11/19/2025, 4:50 PMlibs catalog that is feed from a libs.versions.toml file.
But that both are called libs is no rule, that's just convention and consistency.Vampire
11/19/2025, 4:51 PMfoo and feed it from a file called bar.toml (the missing versions. is not a typo)Vampire
11/19/2025, 4:52 PMbuild.gradle.kts, but could also be called foo.gradle.kts for a project called bar if you configure it like thatVampire
11/19/2025, 4:52 PMColton Idle
11/19/2025, 4:52 PMgradle/libs.versions.tomlVampire
11/19/2025, 4:54 PMColton Idle
11/19/2025, 4:55 PMColton Idle
11/19/2025, 4:59 PMVampire
11/19/2025, 5:00 PMOkay. so i would need to rename my toml in the submodule though right?As said I think 3 times with different words: NO, you can name the file anything you like, including the current name
Vampire
11/19/2025, 5:02 PMlooks like if i rename my submodules toml, then i would need to update all references of libs.* in my submoduleI think we are at a point where you need to shown an MCVE. You probably omit the small little detail that makes me not giving the answer you need.
Colton Idle
11/19/2025, 5:03 PMColton Idle
11/19/2025, 5:15 PMgradle/
libs.versions.toml
submodules/
mylibrary1/
gradle/
libs.versions.toml
In my root project settings.gradle.kts I have
versionCatalogs {
create("libs") { from(files("submodules/mylibrary1/gradle/libs.versions.toml")) }
}
When I try to sync, I get a "You can only call the 'from' method a single time"
If I update my root project settings.gradle.kts to
versionCatalogs {
create("submoduleLibs") { from(files("submodules/mylibrary1/gradle/libs.versions.toml")) }
}
then I get build errors in submodules/mylibrary1/mysdk/build.gradle.kts of "Unresolved reference to version catalog" when it tries to compile alias(libs.plugins.android.library).
If I change it to alias(submoduleLibs.plugins.android.library) then it works. But I'd prefer to not have to change all of the libs references in mylibrary1 to submoduleLibs so that's where it's currently not clicking for me of "NO, you can name the file anything you like, including the current name" because it seems like I still have to go and update all of my usages of libs.* in mylibrary1.Vampire
11/19/2025, 5:16 PMinclude / includeBuild do you do in your root build settings script?Colton Idle
11/19/2025, 5:19 PMinclude(":app")
include(":mysdk") <--- this is from the git submodule
project(":mysdk").projectDir = file("submodules/mylibrary1/mysdk") <--- this is from the git submoduleVampire
11/19/2025, 5:20 PMmysdk project, is this exclusively used in this root build you are including it to, or do you also include it in other builds?Colton Idle
11/19/2025, 5:21 PMimplementation(project("mysdk"))Vampire
11/19/2025, 5:22 PMColton Idle
11/19/2025, 5:22 PMVampire
11/19/2025, 5:23 PMinclude the mysdk folder, not meaning the physical folder on disk, but also the same folder pulled into other repositories with submodules and similar things.Colton Idle
11/19/2025, 5:25 PMsubmodules/mylibrary1/settings.gradle.kts there is a line of include(":mysdk")Vampire
11/19/2025, 5:25 PMincludeBuild the whole build that owns that project or you come into hell's kitchen quite easily.Vampire
11/19/2025, 5:26 PMVampire
11/19/2025, 5:28 PMinclude(":mysdk") to includeBuild("submodules/mylibrary1") and your implementation(project("mysdk")) to implementation("group-of-sdk:mysdk") and you should be fine and also no problems with version catalog, as mysdkยด uses the version catalog of its own build which is totally independent from your root build, and just happens to be built before as far as necessary to satisfy the dependency.Colton Idle
11/19/2025, 5:33 PMColton Idle
11/19/2025, 5:33 PMColton Idle
11/19/2025, 5:36 PMinclude(":mysdk") to includeBuild("submodules/mylibrary1")
Done
implementation(project("mysdk")) to implementation("group-of-sdk:mysdk")
Wont build "String module notation 'com.mygroupname.sdk:mysdk' is invalid"
FWIW, I'm using the com.mygroupname.sdk from the sdks modules publishing block (maven) where we declared a groupId of "com.mygroupname.sdk", but I'm guessing maybe I shouldn't be using the maven publishing blocks group id?TrevJonez
11/19/2025, 5:40 PMVampire
11/19/2025, 5:40 PMVampire
11/19/2025, 5:41 PMincludeBuild will not work as you changed the identity and so you need to add manual substitution rulesVampire
11/19/2025, 5:41 PMVampire
11/19/2025, 5:42 PMWont build "String module notation 'com.mygroupname.sdk:mysdk' is invalid"can you show a build scan, or maybe the full error? Did you copy it or type it. If you typed it you might fixed the error on the fly. Because the notation should be fine.
Colton Idle
11/19/2025, 5:42 PMVampire
11/19/2025, 5:43 PMIIUC gradle is going to map the normal maven dependency notation to what the composite build exposes. so you need a version value there, but it won't really mean anything since the composite build will replace itNo, you don't need a version, when it is served from an included build it would anyway ignore the version, so you also do not need to declare one.
TrevJonez
11/19/2025, 5:44 PMVampire
11/19/2025, 5:44 PMbut it was decided to use git submodules so we can iterate faster.Yeah, for developing lib and consumer together efficiently is exactly the original use-case for composite builds (
includeBuild)Vampire
11/19/2025, 5:44 PMI will remove the group and name in the publishing block and see if that'll work.It will probably not solve an invalid string notation
Vampire
11/19/2025, 5:45 PMVampire
11/19/2025, 5:45 PMI want to say if you are still going to publish things out for consumption outside of the composite build you do need it so your pom/module files have the correct info in them?That might be correct indeed, yes.
Vampire
11/19/2025, 5:46 PMVampire
11/19/2025, 5:46 PMColton Idle
11/19/2025, 5:47 PMimplementation("") declaration but still no dice. I have a feeling that I just don't know what the group id actually is. lolVampire
11/19/2025, 5:47 PMVampire
11/19/2025, 5:47 PMVampire
11/19/2025, 5:48 PMColton Idle
11/19/2025, 5:49 PMVampire
11/19/2025, 5:54 PMimplementation("commons-io:commons-io:1.0.0) and at the point where you want to develop a change for 1.0.1 in commons-io and test that right away in project X, you make X include the commons-io build until you are happy with your changes and then remove the includeBuild again. (commons-io per-se would of course not work as it is not a Gradle build, just serving as example)Vampire
11/19/2025, 5:55 PMColton Idle
11/19/2025, 6:02 PMColton Idle
11/19/2025, 10:02 PM./gradlew projects
------------------------------------------------------------
Root project 'MyApp'
------------------------------------------------------------
Root project 'MyApp'
+--- Project ':app'
\--- Project ':mylibrary'
after
------------------------------------------------------------
Root project 'MyApp'
------------------------------------------------------------
Root project 'MyApp'
\--- Project ':app'
Included builds:
\--- Included build ':mylibrary1'
The line I needed was (which of course seems so obvious now)
implementation("mylibrary1:mylibrary")Colton Idle
11/19/2025, 10:03 PMVampire
11/19/2025, 10:09 PMColton Idle
11/20/2025, 1:57 PMVampire
11/20/2025, 2:13 PM