简体   繁体   中英

How to run main file using gradle?

I have an application in java written in IntelliJ using gradle. Right now I can run tests but I'd like to run main file to check execution by myself. Does anyone know how to run main file?

Looks like you use Java. In this case:

  1. Apply application plugin
  2. Define mainClassName property

The build.gradle.kts fill be like:

plugins {
    application
}

application {
    mainClassName = "org.gradle.sample.Main"
}

Next you can start application via gradlew run

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM