Unit testing 如何创建jar文件?

Unit testing 如何创建jar文件?,unit-testing,selenium,groovy,junit,geb,Unit Testing,Selenium,Groovy,Junit,Geb,如何在eclipse中为基于Geb Groovy的项目创建可执行jar项目。 以下是目录结构: pages包包含groovy文件 testclasses包包含测试用例groovy文件 utils包包含用于读取excel工作表数据的groovy文件 非常感谢您提供创建jar文件的详细说明。如果您正在处理的项目是gradle项目,我建议您查看一个名为“shadowJar”的任务 in build.gradle会有如下内容: apply plugin: "com.github.johnrengelm

如何在eclipse中为基于Geb Groovy的项目创建可执行jar项目。 以下是目录结构:

pages包包含groovy文件 testclasses包包含测试用例groovy文件 utils包包含用于读取excel工作表数据的groovy文件


非常感谢您提供创建jar文件的详细说明。

如果您正在处理的项目是gradle项目,我建议您查看一个名为“shadowJar”的任务

in build.gradle会有如下内容:

apply plugin: "com.github.johnrengelman.shadow"

mainClassName = '<Name of your Main Class>' //This will act as the jar's main point of entry the 'Main' method found in this class will be executed when the jar is executed

shadowJar {
    manifest {
        attributes 'Main-Class': mainClassName
    }
}
apply插件:“com.github.johnrengelman.shadow”
mainClassName=''//这将充当jar的主入口点。在执行jar时,将执行此类中找到的“main”方法
暗影罐{
显示{
属性“主类”:mainClassName
}
}
然后,只需运行shadowJar任务,就会在构建文件夹中生成一个jar文件。它还应该包含所有依赖项