【发布时间】:2018-08-09 14:31:03
【问题描述】:
如何在 Eclipse 中为基于 Geb-Groovy 的项目创建可执行 jar 项目。 以下是目录结构:
页面包包含 groovy 文件 testclasses 包包含测试用例 groovy 文件 utils 包包含 groovy 文件,用于读取 excel 表的数据。
非常感谢创建 jar 文件的详细说明。
【问题讨论】:
标签: unit-testing selenium groovy junit geb
如何在 Eclipse 中为基于 Geb-Groovy 的项目创建可执行 jar 项目。 以下是目录结构:
页面包包含 groovy 文件 testclasses 包包含测试用例 groovy 文件 utils 包包含 groovy 文件,用于读取 excel 表的数据。
非常感谢创建 jar 文件的详细说明。
【问题讨论】:
标签: unit-testing selenium groovy junit geb
如果您正在使用的项目是 gradle 项目,我建议您查看名为“shadowJar”的任务https://github.com/johnrengelman/shadow
在 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
}
}
然后您只需运行 shadowJar 任务并在您的构建文件夹中生成一个 jar 文件。它还应该包含您的所有依赖项。
【讨论】: