使用特定软件包时无法找到或加载主类

我需要使用browsermob-proxy 。

我的项目可以从IDE运行,但是当我通过gradle构建它并在我的gradle配置文件中添加compile 'net.lightbody.bmp:browsermob-core:2.1.4' ,jar被成功构建(没有任何错误) ,但是主要功能没有加载:

#gradle clean jar

#java -jar build/proxy-0.1.jar

“错误:无法找到或加载主类myproject.MainKt”

如果我将这个实用程序添加到我现有的包(可以构建并运行为一个胖罐子),它不能建立。

我究竟做错了什么?

是否有可能是browsermob-proxy中的错误?

谢谢。

我的gradle文件如下:

 group 'proxy' version '0.1' buildscript { ext.kotlin_version = '1.1.3' repositories { mavenCentral() } dependencies { classpath group: 'org.jetbrains.kotlin', name: 'kotlin-gradle-plugin', version: kotlin_version classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.0-M6' } } apply plugin: 'kotlin' apply plugin: 'java' apply plugin: 'org.junit.platform.gradle.plugin' repositories { mavenCentral() jcenter() maven { url 'https://jitpack.io' } } dependencies { compile 'org.jetbrains.kotlin:kotlin-stdlib-jre8' compile 'org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version' compile 'net.lightbody.bmp:browsermob-core:2.1.4' testCompile("org.junit.jupiter:junit-jupiter-api:5.0.0-M6") testCompile("org.junit.jupiter:junit-jupiter-params:5.0.0-M6") testRuntime("org.junit.jupiter:junit-jupiter-engine:5.0.0-M6") } jar { destinationDir = file('build/') manifest { attributes 'Main-Class': 'myproject.MainKt' } from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } }