Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 570 Vote(s) - 3.55 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'setter for mainClassName: String' is deprecated. Deprecated in Java

#1
I have a vert.x web app written in Kotlin and Gradle as the build tool. The web app has been generated with

[To see links please register here]

.

In the `build.gradle.kts` it shows:

[![enter image description here][1]][1]

that `mainClassName` has been deprecated.

the content of the `build.gradle.kts` file:
```
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.tasks.testing.logging.TestLogEvent.*
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin ("jvm") version "1.4.10"
application
id("com.github.johnrengelman.shadow") version "5.2.0"
id("org.flywaydb.flyway") version "7.1.1"
}

group = "io.databaker"
version = "1.0.0-SNAPSHOT"

repositories {
mavenCentral()
jcenter()
}

val kotlinVersion = "1.4.10"
val vertxVersion = "4.0.0.CR1"
val junitJupiterVersion = "5.6.0"

val mainVerticleName = "io.databaker.MainVerticle"
val watchForChange = "src/**/*"
val doOnChange = "./gradlew classes"
val launcherClassName = "io.vertx.core.Launcher"

application {
mainClassName = launcherClassName
}

dependencies {
implementation("io.vertx:vertx-auth-jwt:$vertxVersion")
implementation("io.vertx:vertx-web:$vertxVersion")
implementation("io.vertx:vertx-pg-client:$vertxVersion")
implementation("io.vertx:vertx-lang-kotlin-coroutines:$vertxVersion")
implementation("io.vertx:vertx-json-schema:$vertxVersion")
implementation("io.vertx:vertx-lang-kotlin:$vertxVersion")
implementation(kotlin("stdlib-jdk8"))
testImplementation("io.vertx:vertx-junit5:$vertxVersion")
testImplementation("org.junit.jupiter:junit-jupiter:$junitJupiterVersion")
}

val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions.jvmTarget = "11"

tasks.withType<ShadowJar> {
archiveClassifier.set("fat")
manifest {
attributes(mapOf("Main-Verticle" to mainVerticleName))
}
mergeServiceFiles {
include("META-INF/services/io.vertx.core.spi.VerticleFactory")
}
}

tasks.withType<Test> {
useJUnitPlatform()
testLogging {
events = setOf(PASSED, SKIPPED, FAILED)
}
}

tasks.withType<JavaExec> {
args = listOf("run", mainVerticleName, "--redeploy=$watchForChange", "--launcher-class=$launcherClassName", "--on-redeploy=$doOnChange")
}
```
Through what should I replace the `mainClassName`?


[1]:
Reply

#2
It seems the latest way of doing this is:


application {
mainClass.set(launcherClassName)
}
Reply

#3
Setting `mainClassName` on the top level should work too:

```kotlin
mainClassName = "io.vertx.core.Launcher"
```

[To see links please register here]

Reply

#4
for spring boot project
```kotlin
springBoot {
mainClass.set("your.full.classname")
}
```
Reply

#5
Any of the below 3 should work:

springBoot {
mainClass.set('package.class')
}

bootJar {
mainClass.set('package.class')
}

application {
mainClass.set('package.class')
}
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through