I have installed Natural 0.7.6 plug-in from eclipse marketplace and I have Windows 10.
Eclipse version: Eclipse IDE for Java Developers
Version: 2020-03 (4.15.0)
Build id: 20200313-1211
Maven dependencies related to Cucumber:
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>5.7.0</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>5.7.0</version>
<scope>test</scope>
</dependency>
</dependencies>
.feature file
step definition file
[1]: [https://i.stack.imgur.com/e22x3.png][1]
[2]: https://i.stack.imgur.com/cAfLY.png
The .feature file complains about "No definition found for ".
CTRL+CLICK on .feature file step is not navigating to stepDefinition file (screenshots attached).
Am I missing any plugin? Is there any compatibility issues with Eclipse IDE version and the Cucumber plug-in I am using? I appreciate your help guys.
Steps to make it work.
Clear out all the cucumber related plugins(e.g. Natural 0.9, cucumber eclipse plugin 1.0.0.xxxxx). Please do follow the suggestion of restarting your eclipse.
Go to Help --> Eclipse Market place --> Install 'cucumber-eclipse' plugin. Please do follow the suggestion of restarting your eclipse.
Right click on your project --> Configure --> Convert to Cucumber project.
Now try to navigate to your step definition by 'Ctrl+click' on test step in feature file
Edit: I also changed JRE system library to 1.8( I am not sure it has any influence to make cucumber work )
I had same problem that CTRL+Click was not working in feature files when I installed Natural plugin in Eclipse IDE.
Later, I uninstalled Natural plugin, and installed "Cucumber Eclipse" plugin, and now I can perform ctrl+click on step name of feature file to navigate to the step definition file.
You can follow below stpes:
Un-install Natural plugin
Install Cucumber Eclipse plugin
Note: Below are my Eclipse version details. "Cucumber Eclipse" plugin may not be available for latest Eclipse version
Version: 2019-06 (4.12.0)
Build id: 20190614-1200
With the Cucumber Eclipse plugin, cleaning the Cucumber project (Project > Clean...) made the Gherkin steps Ctrl+click-able again.
You need a cucumber runner file first and inside that you need to glue the step definition file with the cucumber feature. The thing is that in cucumber if you place the feature file, step definition file and runner file in the same package then automatically, it will be able to map the steps from the step definition file with the feature file. But as per the screenshots, I can see that feature and step definition is present in the different packages. Please create a runner file as shown below
>
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
#RunWith(Cucumber.class)
#CucumberOptions(
features = "<Directory path containing features>"
,glue={"<Step definition package name>"}
) // example: Features: src/test/resources/features, Glue: com.package.name.stepdefs
public class TestRunner {
}
TestRunner.java
If you are not able to get to the relevant step definition method from Feature file by either F3 or CTRL+ Left Mouse Click, change the default editor of Feature file as below
image to select correct Cucumber Editor
Related
My Runner class is as below:
#RunWith(CucumberWithSerenity.class)
#CucumberOptions(features = "src/test/resources/features/"
,glue={"com.stepdefs"}
,dryRun=false
,monochrome=true
,plugin = {pretty})
public class Runner {
}
I don't have any issues with executing them using maven. It works totally fine. Only the issue with Eclipse where feature steps can't recognize any step defs. So i can't find them using F3. I have added this below dependency as well:
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>gherkin</artifactId>
<version>3.2.0</version>
</dependency>
As well i converted the project to cucumber project, added cucumber plugins in Eclipse. My Eclipse version is 2020-12. Still no luck.
I am using cucumber6, I think this is an existing issue for cucumber 4 and up:
https://github.com/cucumber/cucumber-eclipse/issues/372
https://github.com/cucumber/cucumber-eclipse/issues/368
In my project, I have the class name as part of the definition, e.g:
glue={"com.stepdefs.StepDefinitions"}
I am new to maven and am experiencing difficulties while trying to mavenise a Java project.
Setting:
IDE: Eclipse Oxygen.2 Release (4.7.2)
Java: 8
m2e: 1.8.2
What I did:
- copy-pasted the entire original java project and renamed it
- right-click in eclipse: Configure > Convert to Maven project
- in java build path, deletion of libraries import from original local lib repo. The build path shows the Maven Dependencies folder, with the only junit library.
- maven install => downloaded things in the user/.m2/repository/, but not all.
What does not work:
When I try to add a dependency right from a file:
,
nothing pops up in the artifact selection windows, even though there is a commons-logging/ folder in m2/repository
When I try to add the dependency manually in the pom.xml:
<dependency>
<groupId>org.kie.modules</groupId>
<artifactId>org-apache-commons-configuration-main</artifactId>
<version>6.5.0.Final</version>
<type>pom</type>
</dependency>
but the package resolution error still appears in the java file, and I get this warning after Maven install
`[WARNING] The POM for org.kie.modules:org-apache-commons-configuration-main:pom:6.5.0.Final is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details`
I did Maven Update project, eclipse project clean, nothing changes.
My goal for now is just that eclipse understands (at least for one library), that it has to take it from maven repository. I still have many other dependencies to solve (intra-project), but that will be the next step.
Thanks for your help.
The cause of the issue is stated in the warning message :
[WARNING] The POM for
org.kie.modules:org-apache-commons-configuration-main:pom:6.5.0.Final
is invalid, transitive dependencies (if any) will not be available,
enable debug logging for more details
It means that the pom.xml downloaded in your local maven repository exists but is not valid.
Delete the folder of the dependency downloaded in your local maven repository and try again.
If you still have the same problem, check that your central repository that provides the dependency provides also correctly the pom.xml for that.
You can do it by browsing the directory of the dependency from a web browser.
For example we can see that the maven central repository provides a valid pom :
http://central.maven.org/maven2/org/kie/modules/org-apache-commons-collections-main/6.5.0.Final/org-apache-commons-collections-main-6.5.0.Final.pom
I’m using Eclipse Kepler (Java 8). with my Maven (v 3.2.3) project. I’m using JUnit 4.11, as declared in my pom.xml file …
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
I’m trying to run some JUnit tests and I have this at the top of my tests
#FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class MyTest
{
However, when I run the test in Eclipse (by right clicking the name of the file and selecting “Run As”, “JUnit Test”), Eclipse is not running the tests in ascending order by name, but instead running the tests one by one as they are listed in the file.
My question is, how can I get Eclipse to respect the “FixMethodOrder” directive in my file? Note that I’m not interested in lectures about why it shouldn’t matter what order you run JUnit tests in.
Open your project build path (right-click on project > Build Path > Configure Build Path...) and go to the Libraries tab. Do you have "JUnit 4" on your Eclipse classpath or just "Maven Dependencies":
Remove it by selecting "JUnit 4" and hitting the remove button to the right. Maven specifies all your dependencies so you don't need Eclipse adding to that.
In my experience Eclipse seems to prefer its own JUnit library at runtime over the JUnit library provided by "Maven Dependencies": I get different results in test execution order between Eclipse and direct Maven when using #FixMethodOrder if the Eclipse "JUnit 4" library is on the classpath, but if I remove that library then Eclipse and Maven are in agreement.
I'm having problems trying to just create a Maven project using Scala (v2.11.6) within Eclipse (Luna). The instructions here says to install both plugins below.
Maven Integration in Eclipse
m2eclipse-scala connector
Both plugins can be installed by using the m2eclipse-scala update site. So here's what I did in my first attempt.
Download Eclipse Luna (for JavaEE developers)
Install "both" plugins above by using the m2eclipse-scala update site.
When Eclipse loads up, I attempt to create a Maven project, and the archetype I want to use is Group Id=net.alchim31.maven, Artifact Id=scala-archetype-simple, Version=1.5. However, this archetype never shows up when I enter in "scala-arch" in the filter text field.
The only project I see is the one with Group Id=org.scala-tools.archetypes, Artifact Id=scala-archetype-simple, Version=1.2. When I select this archetype to use, I get a bunch of error messages in Eclipse.
error while loading ConsoleRunner, Scala signature ConsoleRunner has wrong version expected: 5.0 found: 4.1 in ConsoleRunner.class
error while loading JUnit4, Scala signature JUnit4 has wrong version expected: 5.0 found: 4.1 in JUnit4.class
error while loading Specification, Scala signature Specification has wrong version expected: 5.0 found: 4.1 in Specification.class
In my second attempt, I try to download the pre-packaged bundle (Scala IDE for Eclipse). Again, when I attempt to create a Scala Maven project, I don't see the Maven archetype for Group Id=net.alchim31.maven (only for Group Id=org.scala-tools.archetypes).
Any ideas on what I'm doing wrong here? Or where I can find a vanilla Scala Maven project to import/modify and use for my own purpose?
Here's how I got it to work. It seems all the archetypes aren't available, so based on this answer, I created a remote catalog
Before
So do this
Go to [Windows] → [Preferences] → [Maven] → [Archetypes] → Add Remote Catalog and create the catalog, then Apply
For copy-pasting:
Catalog File: http://repo1.maven.org/maven2/archetype-catalog.xml
Description: Remote Archetypes
Go back to creating a new Maven project. Select the Remote Catalog from the dropdown. It will take a few moments to gather all the archetypes. You can see the progress at the very bottom right of the IDE. When it's done, you should be able to see the archetypes
After
Create your project with groupId and artifactId and such.
Right click the project, then from the context menu [Run As] &rarr [Maven Build]. In the dialog, type clean package into the goals. The run. The project should build and run the tests.
For me at first I got an error on the build. It was because my default environment is using Java 8. I'm pretty new to Scala, so I'm not sure is there is a problem with Scala and Java 8 or not (I think it's the Scala version in the pom (2.10.0)). But what I did to get it to work was just change the Java version used in the IDE to Java 7.
Basically just go to [Windows] → [Preferenes] → [Java] → [Installed JREs] → Add → [System VM] → Next → Directory → Find the directory of the Java home (version 7) → Finish → Then in the list tick Java 7.
Then build again. It should work. Good Luck!
One point I want to add, If you are getting following error while installing the archetype showed in image 1
Can't resolve Archetype
org.glassfish.jersey.archetypes:jersey-quickstart-webapp:2.21
org.eclipse.core.runtime.CoreException: Could not resolve artifact
org.glassfish.jersey.archetypes:jersey-quickstart-webapp:pom:2.21
Image 1:
Then before procedding with the solution specified above, try to complete these steps in eclipse.
I faced the same problem and chanced upon this SO question, as well as the answer, given by #peeskillet (many thanks). I am using:
Maven 3.3.3
Eclipse Luna Scala IDE 4.0.0.-vfinal-20150305-1644-Typesafe
Scala 2.11.6
JDK 1.8
After following the steps exactly as given here, I hit a wall. When I chose the right archetype (net.alchim31.maven), I was greeted with this error:
Could not resolve artifact net.alchim31.maven:scala-archetype-simple:pom:1.5
Suspecting that the maven embedded in eclipse was acting funny, I visited [Windows] -> [Maven] -> [Installations] and added local installation of maven (whatever is set to M2_HOME in my shell). But, no luck!
Exasperated, I visited this site: Scala Doc and switched back to command-line as this page instructs. Surprisingly (to me, at least), it worked. A maven-Scala project was created in the present directory, which I could import into Eclipse.
Just so that I am not misunderstood, I am not suggesting that #peeskillet's answer is wrong. Just wanted to share another way of creating a maven-scala project on Eclipse, in case it helps someone. I have not yet understood, why Eclipse-Scala-IDE is yet to give that 'Aha' feeling.
After you have successfully created the scala-maven project as described above, you will probably see an error "Type not found: type JUnitRunner specs.scala". In that case, manually add the following XML snippet to your pom.
<dependency>
<groupId>org.specs2</groupId>
<artifactId>specs2-junit_${scala.compat.version}</artifactId>
<version>2.4.16</version>
<scope>test</scope>
</dependency>
Moreover, to avoid errors when running mvn test,
[ERROR] scalac error: bad option: '-make:transitive'
You also need to delete the following line from the pom.xml file:
<arg>-make:transitive</arg>
I am using Eclipse, Version: Indigo Service Release 1.
My GWT version is 2.4.0. I installed everything like GWT and Maven related plugins.
I am trying to import a existing gwt-maven project. When importing, I see this dialog:
Can anyone tell me why and how to solve it?
Google is your dear friend.
By entering "no marketplace entries found to handle gwt-mavn-plugin", I got:
Error when importing Maven-GWT project ("No marketplace entries found to handle gwt-maven-plugin")
gwt-maven-plugin with Eclipse Indigo
Eclipse: Import Maven project, missing maven-gae-plugin
EDIT :
Actually I would advise you to use maven from the command line instead of using the Maven plugin in Eclipse as I had exprienced many issues with it.
From the command line, run the following commands:
To compile and install : mvn clean install
to generate eclipse project: mvn eclipse:eclipse
Afterwards, from your eclipse, import your generated project as a normal project and voila!
Hope this helps!