./gradlew installDist错误:无法找到或加载主类

5kgi1eie  于 2023-04-06  发布在  其他
关注(0)|答案(1)|浏览(162)

我正在尝试测试./gradlew installDist任务。
C:\Users\Sandeep Prajapati\Downloads\Ex_Files_Gradle_Java\Exercise Files\chapter_1\01_01\build\install\01_01\bin\01_01.bat1_01_OPTSCLASSPATH* 系统找不到指定的路径
项目结构x1c 0d1x
build.gradle文件:

plugins {
    id 'java'
    id 'application'
}

mainClassName = 'com.linkedinlearning.calculator.Main'

java {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
}

version = '1.0.0'

compileJava{
    options.compilerArgs << '-Werror'
}

jar {
    archiveBaseName = 'calculator'
}

application {
    mainClass = 'com.linkedinlearning.calculator.Main'
}

enter code here

我运行的命令是/install/01_01/bin ~ ./01_01 add 1 2

woobm2wo

woobm2wo1#

jar任务archiveBaseName与rootProject名称不匹配,通过rootProject.name在settings.gradle中添加www.example.com = 'calculator'解决了该问题

相关问题