Skip to content

Build errors with Gradle 7.6 #18

@eihqnh

Description

@eihqnh

Hello I m new in gradle.
I tried building test projects but errors occured.

`
Starting a Gradle Daemon (subsequent builds will be faster)

Task :compileScala
[Error] /root/scalajs-gradle/src/main/scala/org/podval/tools/test/SourceMappingTestResultProcessor.scala:21:58: Found: Throwable
Required: org.gradle.api.tasks.testing.TestFailure
[Error] /root/scalajs-gradle/src/main/scala/org/podval/tools/test/TestResultProcessorEx.scala:40:7: Found: (throwable : Throwable)
Required: org.gradle.api.tasks.testing.TestFailure
two errors found

Task :compileScala FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':compileScala'.

Compilation failed

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.6/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 52s
1 actionable task: 1 executed
`
I want to add this plugin in my project.
But errors occured.
Any suggestions or more examples?
I will appreciate it :)

`
plugins { id("org.podval.tools.scalajs") version "0.4.1" }

// application {
// mainClass.set("Main")
// applicationDefaultJvmArgs = listOf("--enable-preview")
// }

repositories {
mavenCentral()
maven { url = uri("https://papermc.io/repo/repository/maven-public/") }
}

val scalaMajorVersion = '3'
val scalaVersion = "$scalaMajorVersion.2.0"

dependencies {
implementation("org.scala-lang:scala3-library_3:$scalaVersion")
}

tasks.withType() { scalaCompileOptions.additionalParameters = listOf("-scalajs") }

link {
optimization = "Full" // one of = "Fast", "Full"
moduleKind = "NoModule" // one of = "NoModule", "ESModule", "CommonJSModule"
moduleSplitStyle = "FewestModules" // one of = "FewestModules", "SmallestModules"
prettyPrint = false
moduleInitializers {
module {
className = "Main"
mainMethodName = "main"
mainMethodHasArgs = true
}
}
}
`

`

Configure project :
e: /root/mctest/build.gradle.kts:29:1: Expression 'link' cannot be invoked as a function. The function 'invoke()' is not found
e: /root/mctest/build.gradle.kts:29:1: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public val TaskContainer.link: TaskProvider<LinkTask.Main> defined in org.gradle.kotlin.dsl
e: /root/mctest/build.gradle.kts:30:3: Unresolved reference: optimization
e: /root/mctest/build.gradle.kts:31:3: Unresolved reference: moduleKind
e: /root/mctest/build.gradle.kts:32:3: Unresolved reference: moduleSplitStyle
e: /root/mctest/build.gradle.kts:33:3: Unresolved reference: prettyPrint
e: /root/mctest/build.gradle.kts:34:3: Unresolved reference: moduleInitializers
e: /root/mctest/build.gradle.kts:35:5: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun Dependencies.module(group: String?, name: String, version: String?): ExternalModuleDependency defined in org.gradle.kotlin.dsl
public fun DependencyHandler.module(notation: Any, clientModuleConfiguration: ClientModuleScope.() -> Unit): ClientModule defined in org.gradle.kotlin.dsl
public fun DependencyHandler.module(group: String, name: String, version: String? = ..., configuration: String? = ..., classifier: String? = ..., ext: String? = ...): ClientModule defined in org.gradle.kotlin.dsl
public fun DependencyHandler.module(group: String, name: String, version: String? = ..., configuration: String? = ..., classifier: String? = ..., ext: String? = ..., clientModuleConfiguration: ClientModuleScope.() -> Unit): ClientModule defined in org.gradle.kotlin.dsl
e: /root/mctest/build.gradle.kts:36:7: Unresolved reference: className
e: /root/mctest/build.gradle.kts:37:7: Unresolved reference: mainMethodName
e: /root/mctest/build.gradle.kts:38:7: Unresolved reference: mainMethodHasArgs

FAILURE: Build failed with an exception.

  • Where:
    Build file '/root/mctest/build.gradle.kts' line: 29

  • What went wrong:
    Script compilation errors:

    Line 29: link {
    ^ Expression 'link' cannot be invoked as a function. The function 'invoke()' is not found

    Line 29: link {
    ^ Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
    public val TaskContainer.link: TaskProvider<LinkTask.Main> defined in org.gradle.kotlin.dsl

    Line 30: optimization = "Full"
    ^ Unresolved reference: optimization

    Line 31: moduleKind = "NoModule"
    ^ Unresolved reference: moduleKind

    Line 32: moduleSplitStyle = "FewestModules"
    ^ Unresolved reference: moduleSplitStyle

    Line 33: prettyPrint = false
    ^ Unresolved reference: prettyPrint

    Line 34: moduleInitializers {
    ^ Unresolved reference: moduleInitializers

    Line 35: module {
    ^ Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
    public fun Dependencies.module(group: String?, name: String, version: String?): ExternalModuleDependency defined in org.gradle.kotlin.dsl
    public fun DependencyHandler.module(notation: Any, clientModuleConfiguration: ClientModuleScope.() -> Unit): ClientModule defined in org.gradle.kotlin.dsl
    public fun DependencyHandler.module(group: String, name: String, version: String? = ..., configuration: String? = ..., classifier: String? = ..., ext: String? = ...): ClientModule defined in org.gradle.kotlin.dsl
    public fun DependencyHandler.module(group: String, name: String, version: String? = ..., configuration: String? = ..., classifier: String? = ..., ext: String? = ..., clientModuleConfiguration: ClientModuleScope.() -> Unit): ClientModule defined in org.gradle.kotlin.dsl

    Line 36: className = "Main"
    ^ Unresolved reference: className

    Line 37: mainMethodName = "main"
    ^ Unresolved reference: mainMethodName

    Line 38: mainMethodHasArgs = true
    ^ Unresolved reference: mainMethodHasArgs

11 errors

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

BUILD FAILED in 5s
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions