Posted December 6, 20204 yr I added follow code to my build script for replace ${version} placeholder in my toml by gradle project version processResources { // This will ensure that this task is redone when the versions change. inputs.property 'version', project.version // Replace stuff in mods.toml, nothing else from(sourceSets.main.resources.srcDirs) { include 'META-INF/mods.toml' // Replace version expand 'version':project.version } // Copy everything else except the mods.toml from(sourceSets.main.resources.srcDirs) { exclude 'META-INF/mods.toml' } } On build it crashes with * What went wrong: Execution failed for task ':ElegantNetworking_1.16:processResources'. > Could not copy file 'C:\Users\hohserg\Documents\GitHub\ElegantNetworking1\ElegantNetworking_1.16\src\main\resources\META-INF\mods.toml' to 'C:\Users\hohserg\Documents\GitHub\ElegantNetworking1\ElegantNetworking_1.16\build\resources\main\META-INF\mods.toml'. How to insert version to toml by gradle?
December 6, 20204 yr Author I found similar question: But it unsolved Edited December 6, 20204 yr by hohserg
December 6, 20204 yr Hey, I may be misunderstanding what you want to do, but make sure you do not change the version string in mods.toml. It should be: version="${file.jarVersion}" That string will be auto-replaced by gradle. In build.gradle under jar/manifest/attributes, you can set "Implementation-Version" to "project.version". e.g. "Implementation-Version": project.version, This should be enough for gradle to pull the version from the Jar Metadata. Note: If you are running from Eclipse your Mod's Version may display as "NONE", that's fine. When you actually create a jar for your mod, for instance with the "build/jar" Gradle Task. That jar should have a valid version when you drop it into a "mods" folder. Edited December 6, 20204 yr by HeavensSword
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.