gradle
gradle copied to clipboard
Build issue with my project.
I am trying to build my project currently but the following exception is being thrown:
> Could not copy file 'C:\Users\nicky\Desktop\fabric-example-mod-master\Grisha\src\main\resources\fabric.mod.json' to 'C:\Users\nicky\Desktop\fabric-example-mod-master\Grisha\build\resources\main\fabric.mod.json'.
> Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed:
SimpleTemplateScript6.groovy: 1: Unexpected input: '(' @ line 1, column 10.
out.print("""{
^
1 error
Help would be greatly appreciated as I am currently under heavy time crunch and struggling >.<
Thank you for your interest in Gradle!
Your issue appears to be a question about how to use Gradle. Your question might be better answered on our forums or StackOverflow. We have several resources on help.gradle.org that you should check out first.
If you think you have come across a Gradle bug, please file a new issue describing the problem and how to reproduce it.
If you think Gradle is missing a feature, please file a new issue describing your use case for the feature.
@mlopatkin not really helpful. He should have provided an example to reproduce the error. But aside from that it's actually a gradle issue not a question how to use gradle. Please reopen this ticket or I will create a new one.
Got the same error:
Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed:
SimpleTemplateScript34.groovy: 1: Unexpected character: '"' @ line 1, column 13.
out.print("""
I created a minimal example to reproduce the issue. In my case it seems gradle kotlin dsl doesn't handle comments inside property files.
Either commenting out this in build.gradle.kts:
tasks.withType<ProcessResources> {
filesMatching("*.properties") {
expand("version" to version, "buildTimestamp" to LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")))
}
}
Or removing this in application.properties:
# \ \\\\\\\\n \\\\) test %m%n
Fixes the build.
@judos thanks, putting this back into the triage queue.
I've run into similar issue. Couldn't really find any obvious reason. Adding escapeBackslash = true
to expand helped.
Example:
filesMatching('**/config*.*') {
expand('version': project.version) {
escapeBackslash = true
}
}
This is affecting me too. I can confirm that it works correctly in v6.9.4, but fails in v7.0.0 (and the latest versions 7.6.1 and v8.0.1)
This seems to happen when there are other unescaped placeholder variables in the yml file.
tasks.processResources {
filesMatching("application.yml") {
expand("profile" to profile)
}
}
# works fine
spring:
profiles.active: ${profile}
batch.job.name: \${job.name:NONE}
# error occurred
spring:
profiles.active: ${profile}
batch.job.name: ${job.name:NONE}
---
> Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed:
SimpleTemplateScript23.groovy: 1: Unexpected input: '(' @ line 1, column 10.
out.print("""spring:
tested on gradle 7.6 related to #24868
Can confirm! Gradle 8.4, I'm expanding namespace
, package
, and version
.
Execution failed for task ':processResources'.
> Could not copy file '/home/<redacted>/Projects/Magnesium/src/main/resources/quilt.mod.json' to '/home/<redacted>/Projects/Magnesium/build/resources/main/quilt.mod.json'.
> Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed:
SimpleTemplateScript4.groovy: 1: Unexpected input: '(' @ line 1, column 10.
out.print("""{
^
The expanded file
{
"schema_version": 1,
"quilt_loader": {
"group": "${package}",
"id": "${namespace}",
"version": "${version}",
"metadata": {
"name": "Magnesium",
"description": "Actual data manipulation for data packs.",
"contributors": {
"Laxystem": "Developer"
},
"contact": {
"homepage": "https://laxla.quest/",
"issues": "https://github.com/LaylaMeower/${namespace}/issues",
"sources": "https://github.com/LaylaMeower/${namespace}/issues"
},
"icon": "assets/${namespace}/icon.png"
},
"intermediate_mappings": "net.fabricmc:intermediary",
"entrypoints": {
"init": {
"adapter": "kotlin",
"value": "${package}.${namespace}.Magnesium"
}
},
"depends": [
{
"id": "quilt_loader",
"versions": ">=0.19.2"
},
{
"id": "quilted_fabric_api",
"versions": ">=7.4.0"
},
{
"id": "qkl",
"versions": ">=2.1.0"
},
{
"id": "minecraft",
"versions": ">=1.20.1"
}
]
},
"mixin": "${namespace}.mixins.json"
}
Renaming package
to group
seems to solve the problem -- is it because package
is a groovy operator?
Getting same error with below property in yaml, workaround on it setting the property through an *.properties override file
logging:
pattern:
correlation: "[${spring.application.name:},%X{traceId:-},%X{spanId:-}] "
Same issue, workaround not possible for me as the resource is generated by a plugin, please resolve