Closed SchlauFuchs closed 3 years ago
I am having a very similar problem trying to set the args the way the documentation suggests
named<NpmSetupTask>("npmSetup") {
// Hack for Gradle node plugin ignoring the project's .npmrc file during npmInstall
doFirst {
val npmRegistry = "https://my.registry.here/api/npm/npm/"
args.set(listOf("--registry", npmRegistry))
}
}
This ends up causing this failure
> Task :project:npmSetup FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':project:npmSetup'.
> The value for task ':project:npmSetup' property 'args' is final and cannot be changed any further.
It's perhaps a bit hidden in the documentation, but we have a Kotlin DSL example here https://github.com/node-gradle/gradle-node-plugin/blob/master/src/test/resources/fixtures/kotlin/build.gradle.kts
It's perhaps a bit hidden in the documentation, but we have a Kotlin DSL example here https://github.com/node-gradle/gradle-node-plugin/blob/master/src/test/resources/fixtures/kotlin/build.gradle.kts
Got it working by removing the doFirst
was confused by this line in the faq https://github.com/node-gradle/gradle-node-plugin/blob/master/docs/faq.md#how-do-i-specify-a-registry-for-the-npm-setup-task
Seriously, that helped. :) Maybe take an example in other documentations, where they put code examples in the view both as groovy and kotlin DSL with tabs to switch between.
I haven't toyed a lot with GitHub markdown but I think they have some collapsible thing and we could probably do something like that, but PRs improving documentation is greatly appreciated
Hi,
I have a Gradle config file in Kotlin DSL, and configuring this plugin is currently failing with such an exception:
build.gradle.kts:15:5: Val cannot be reassigned
Any recommendations?