英文:
What are a recent, compatible set of Jars for using Cucumber with Eclipse
问题
以下是要翻译的内容:
我正在寻找能够在Eclipse中运行Cucumber的jar文件列表以及它们的版本。
为了在Eclipse中运行Cucumber,我需要一组兼容的Jar文件。我使用的是一个非常过时的集合,因为我发现很难找到一组新的可以一起工作的文件。下面是我正在使用的已知可行且过时数年的Jar文件列表:
cucumber-core-1.2.6.jar
cucumber-html-0.2.6.jar
cucumber-java-1.2.6.jar
cucumber-junit-1.2.5.jar
cucumber-jvm-deps-1.0.6.jar
cucumber-reporting-3.12.0.jar
gherkin-2.12.2.jar
junit-4.12.jar
mockito-all-2.0.2-beta.jar
今早,我下载了一组类似的“最新”版本,但出现了错误:
cucumber-core-6.7.0.jar
cucumber-html-0.2.7.jar
cucumber-java-6.7.0.jar
cucumber-junit-6.7.0.jar
cucumber-jvm-deps-1.0.6.jar
cucumber-report-generator-1.3.5.jar
cucumber-reporting-5.3.1.jar
gherkin-15.0.2.jar
hamcrest-2.2.jar
junit-4.13.jar
是否有一个已知可工作版本的配置列表呢?
英文:
I am looking for the list of jar files, and their versions, that are able to run cucumber within Eclipse.
In order to run Cucumber in Eclipse I need a compatible set of Jar files. I am using a very out of date set because I am finding it impossible to work out a new set that work together. Below is the list if Jars I am using and which I know work .. which are several years out of date:
cucumber-core-1.2.6.jar
cucumber-html-0.2.6.jar
cucumber-java-1.2.6.jar
cucumber-junit-1.2.5.jar
cucumber-jvm-deps-1.0.6.jar
cucumber-reporting-3.12.0.jar
gherkin-2.12.2.jar
junit-4.12.jar
mockito-all-2.0.2-beta.jar
This morning I downloaded a similar set of 'most recent' version .. and they give errors:
cucumber-core-6.7.0.jar
cucumber-html-0.2.7.jar
cucumber-java-6.7.0.jar
cucumber-junit-6.7.0.jar
cucumber-jvm-deps-1.0.6.jar
cucumber-report-generator-1.3.5.jar
cucumber-reporting-5.3.1.jar
gherkin-15.0.2.jar
hamcrest-2.2.jar
junit-4.13.jar
Is there anywhere a configuration list of known working versions?
答案1
得分: 2
这个早晨,我下载了一个类似的“最新”版本的集合... 但是它们会产生错误:
如果您按照10分钟教程,您将获得一个使用Maven依赖管理的介绍。我强烈建议您投资时间学习Maven或Gradle。除其他外,这些工具将自动化您的依赖管理,这可以让您的生活更加轻松。
例如:
如果您想要将Cucumber与JUnit 4和基于注释的步骤定义一起使用,您可以在Maven的pom.xml
文件中声明此最小的一组依赖项。
<properties>
<cucumber.version>6.7.0</cucumber.version>
</properties>
<dependencies>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
通过告诉Maven您的依赖项,Maven可以计算出您的传递依赖,即您依赖的依赖。
这有很多优点。一个例子是使用mvn dependency:tree
命令列出所有依赖项。这比手动下载jar文件并希望您拥有正确的文件要快得多,也更不容易出错。
$ mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< cucumber:cucumber-java-skeleton >-------------------
[INFO] Building Cucumber-Java Skeleton 0.0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ cucumber-java-skeleton ---
[INFO] cucumber:cucumber-java-skeleton:jar:0.0.1
[INFO] +- io.cucumber:cucumber-java:jar:6.7.0:test
[INFO] | +- io.cucumber:cucumber-core:jar:6.7.0:test
[INFO] | | +- io.cucumber:cucumber-gherkin:jar:6.7.0:test
[INFO] | | +- io.cucumber:cucumber-gherkin-messages:jar:6.7.0:test
[INFO] | | +- io.cucumber:messages:jar:13.0.1:test
[INFO] | | +- io.cucumber:tag-expressions:jar:3.0.0:test
[INFO] | | +- io.cucumber:cucumber-expressions:jar:10.3.0:test
[INFO] | | +- io.cucumber:datatable:jar:3.4.0:test
[INFO] | | +- io.cucumber:cucumber-plugin:jar:6.7.0:test
[INFO] | | +- io.cucumber:docstring:jar:6.7.0:test
[INFO] | | +- io.cucumber:html-formatter:jar:9.0.0:test
[INFO] | | \- io.cucumber:create-meta:jar:2.0.2:test
[INFO] | \- org.apiguardian:apiguardian-api:jar:1.1.0:test
[INFO] +- io.cucumber:cucumber-junit:jar:6.7.0:test
[INFO] \- junit:junit:jar:4.13:test
[INFO] \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.879 s
[INFO] Finished at: 2020-09-19T18:32:42+02:00
[INFO] ------------------------------------------------------------------------
英文:
> This morning I downloaded a similar set of 'most recent' version .. and they give errors:
If you follow the 10 minute tutorial you'll get an introduction that uses Maven dependency management. And I would strongly urge you to invest time in learning either Maven or Gradle. Amongst other things these tools will automate your dependency management and this can make your life much easier.
For example:
If you want to use Cucumber with JUnit 4 and annotation based step definitions you would declare this minimal set of dependencies in a Maven pom.xml
file.
<properties>
<cucumber.version>6.7.0</cucumber.version>
</properties>
<dependencies>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
By telling Maven what your dependencies are Maven can calculate your transitive dependencies i.e: the dependencies of your dependencies.
This has many advantages. One example would be using the mvn dependency:tree
command to list all dependencies. This is much faster and much less error prone then downloading jar files by hand and hoping that you have the right ones.
$ mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< cucumber:cucumber-java-skeleton >-------------------
[INFO] Building Cucumber-Java Skeleton 0.0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ cucumber-java-skeleton ---
[INFO] cucumber:cucumber-java-skeleton:jar:0.0.1
[INFO] +- io.cucumber:cucumber-java:jar:6.7.0:test
[INFO] | +- io.cucumber:cucumber-core:jar:6.7.0:test
[INFO] | | +- io.cucumber:cucumber-gherkin:jar:6.7.0:test
[INFO] | | +- io.cucumber:cucumber-gherkin-messages:jar:6.7.0:test
[INFO] | | +- io.cucumber:messages:jar:13.0.1:test
[INFO] | | +- io.cucumber:tag-expressions:jar:3.0.0:test
[INFO] | | +- io.cucumber:cucumber-expressions:jar:10.3.0:test
[INFO] | | +- io.cucumber:datatable:jar:3.4.0:test
[INFO] | | +- io.cucumber:cucumber-plugin:jar:6.7.0:test
[INFO] | | +- io.cucumber:docstring:jar:6.7.0:test
[INFO] | | +- io.cucumber:html-formatter:jar:9.0.0:test
[INFO] | | \- io.cucumber:create-meta:jar:2.0.2:test
[INFO] | \- org.apiguardian:apiguardian-api:jar:1.1.0:test
[INFO] +- io.cucumber:cucumber-junit:jar:6.7.0:test
[INFO] \- junit:junit:jar:4.13:test
[INFO] \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.879 s
[INFO] Finished at: 2020-09-19T18:32:42+02:00
[INFO] ------------------------------------------------------------------------
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论