简体   繁体   English

如果我的应用程序是使用 gradle 创建的,如何设置 mainClassName?

[英]How to set mainClassName if my application is created with gradle?

My project is created with grails, now i am trying to get the mainClassName in the build.gradle but it keep run out into error as below:我的项目是用 grails 创建的,现在我正在尝试获取 build.gradle 中的 mainClassName,但它一直出现如下错误:

plugins {
    id 'org.springframework.boot' version '2.1.4.RELEASE'
    id 'java'
    id "com.github.ManifestClasspath" version "0.1.0-RELEASE"
}
apply plugin: 'io.spring.dependency-management'
apply plugin: 'application'
mainClassName = 'org.gradle.abc.Main'

Could not find or load main class org.gradle.abc.Main

My main class is in the grails-app -> init -> abc -> Application我的主要 class 在 grails-app -> init -> abc -> Application

below is my mainClassFile下面是我的 mainClassFile

package abc

import grails.boot.GrailsApp
import grails.boot.config.GrailsAutoConfiguration

import groovy.transform.CompileStatic
//import org.springframework.scheduling.annotation.EnableScheduling

@CompileStatic
//@EnableScheduling
class Application extends GrailsAutoConfiguration {
    static void main(String[] args) {
        GrailsApp.run(Application, args)
    }
}

I need to get the MainClassName in order to solve the PathingJar Problems in windows.我需要获取 MainClassName 以解决 windows 中的 PathingJar 问题。

Your main class' FQN is abc.Application ( package abc; ) and not org.gradle.abc.Main您的主要课程的 FQN 是abc.Application ( package abc; ) 而不是org.gradle.abc.Main

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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