What is the dependancy for EmbeddedActiveMQBroker? - java

I'm new to Maven and not sure how to write dependancies for my pom.xml
I am trying to use the following class:
import org.apache.activemq.junit.EmbeddedActiveMQBroker;
And this is my attempt at writing a dependancy:
<dependency>
<groupId>org.apache</groupId>
<artifactId>activemq-junit</artifactId>
<version>5.15.9</version>
</dependency>
But I am still getting an error

Try with the following.
<dependency>
<groupId>org.apache.activemq.tooling</groupId>
<artifactId>activemq-junit</artifactId>
<version>5.13.1</version>
<scope>test</scope>
</dependency>
You can get the details from mvnrepository.com.

First of all we go to the official Maven Dependencies Page of ActiveMQ - https://mvnrepository.com/artifact/org.apache.activemq/activemq-broker/5.15.9.
Then, we go to the "Test Dependencies" category, where we clearly can see the JUnit artifact.
so, use in your pom.xml file next dependency for version 5.15.19:
<!-- https://mvnrepository.com/artifact/org.apache.activemq/activemq-broker -->
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-broker</artifactId>
<version>5.15.9</version>
</dependency>
UPDATE
Add also the next dependency:
<!-- https://mvnrepository.com/artifact/org.apache.activemq.tooling/activemq-junit -->
<dependency>
<groupId>org.apache.activemq.tooling</groupId>
<artifactId>activemq-junit</artifactId>
<version>5.15.9</version>
<scope>test</scope>
</dependency>

Related

ItextPDF dependency not found by Maven

I have the following dependency declared in my pom.xml file
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itext7-core</artifactId>
<version>7.2.0</version>
</dependency>
I'm working in Intellij and it says it's not found. It also won't let me import anything from the com.itextpdf packages.
I've tried a couple clean builds and restarts with no change. I also tried adding the itextpdf repository to the POM file with no change.
it is
<!-- https://mvnrepository.com/artifact/com.itextpdf/itext7-core -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itext7-core</artifactId>
<version>7.2.0</version>
<type>pom</type>
</dependency>

Why do I receive fails when I try to run my framework? [duplicate]

Im having issues running a feature in Cucumber, the feature is very basic as it's from a tutorial.
It is not defined and is as follows:
Feature: Proof that my concept works
Scenario: My first test
Given this is my first step
When this is my second step
Then this is my final step
My Cucumber runner class is as follows:
package cucumber;
import org.junit.runner.RunWith;
import cucumber.api.junit.Cucumber;
#RunWith(Cucumber.class)
#Cucumber.Options(
format = {"pretty", "json:target/"},
features = {"src/cucumber/"}
)
public class CucumberRunner {
}
Also the external .jar files that I have in the project are as follows:
The exception that I'm getting is:
Exception in thread "main" cucumber.runtime.CucumberException: Failed
to instantiate public
cucumber.runtime.java.JavaBackend(cucumber.runtime.io.ResourceLoader)
with [cucumber.runtime.io.MultiLoader#75d837b6]
I've tried to look around online for the solution to this problem but have not had any luck.
I've also discussed with the OP of the tutorial and I'm still awaiting feedback but it has been a while.
I ran into a similar issue and got the same error as you did.
Firstly mention the path to the feature file
features = {"src/cucumber/myfile.feature"}
Anyway, that didn't cause the error.
To just run your Cucumber runner class, all the dependencies you need are
cucmber-junit
cucumber-java and
junit.
I had an additional cucumber-guice which was creating the problem and once I removed it, the error went away and runner was executed successfully.
From the link to the image you have mentioned it looks like you are not using cucumber-guice but still I would recommend you remove other unnecessary cucumber dependencies and try again.
1, I ran into this too few days ago, its simple just remove cucumber-Spring from the dependency.
2 If that doesn't work try updating cucumber-core, cucumber-junit, and cucumber-java all version 1.2.3
I believe the issue is that many of the cucumber add-ins, such as cucumber-testng, cucumber-spring, and (in my case) cucumber-guice, expect the corresponding module they link to be included as well. But apparently the cucumber experts decided not to include this dependency in their pom.xml files, so the problem doesn't manifest itself until runtime.
So (to answer Eugene S's question under LING's answer) if you want to actually use guice with cucumber, you need to also add guice itself as a dependency.
This worked for me, I hope it will work for you as well.
Update your Cucumber dependencies in pom.xml
i.e
cucumber-java (1.2.2)
cucumber-jvm (1.2.2)
cucumber-junit (1.2.2)
And update your Junit dependency as well. (4.11).
The only reason for this error is the version of all the cucumber libraries are not same. It should be like this:
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java8</artifactId>
<version>4.2.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-picocontainer -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>4.2.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-testng -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-testng</artifactId>
<version>4.2.6</version>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
First Thing : We would request you to use Cucumber v >=4.0.0 as you are using pretty old dependency(v1.2.5) of Cucumber.
Key Point : We shall not mix direct & transitive dependencies specially their versions! Doing so can cause unpredictable outcome.
Solution: Please remove. cucumber-core, cucumber-java, cucumber-jvm-deps, gherkin and cucumber-html. They're transitive dependencies and will be provided by your direct dependencies.
You can add below set of cucumber minimal dependencies.
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>4.2.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>4.2.6</version>
<scope>test</scope>
</dependency>
After spending a lot of time on this issue, most of the errors I was receiving were due to dependencies and dependencies versions mismatch. Adding these dependencies to pom.xml file worked for me:
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-scala_2.11</artifactId>
<version>4.7.1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-jvm -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-jvm</artifactId>
<version>4.8.1</version>
<type>pom</type>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java8 -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java8</artifactId>
<version>4.8.1</version>
</dependency>

Selenium WebDriver 3.0.1 Actions class missing from selenium-api-3.0.1.jar from Maven repository

I am using Selenium WebDriver 3.0.1 in a Maven based project. This code snippet fails (does not compile):
Actions myActions = new Actions(myWebDriver);
because the org.openqa.selenium.interactions.Actions class is missing from the selenium-api-3.0.1.jar downloaded from maven.
This is the relevant portion of the pom.xml:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-support</artifactId>
<version>3.0.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-htmlunit-driver</artifactId>
<version>2.52.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>2.31.0</version>
</dependency>
I also tested this alternative dependency in pom.xml:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.0.1</version>
</dependency>
but in both cases the org.openqa.selenium.interactions.Actions class is missing from the downloaded selenium-api artifact.
Searching the class in Maven repository with grepcode.com finds only version 2.47.1 or older.
I downloaded the Selenium Client & WebDriver Language Bindings zip package directly from the http://www.seleniumhq.org/download/ url and the included client-combined-3.0.1-nodeps.jar file does contain the org.openqa.selenium.interactions.Actions class.
It seems that I am missing something ... but I really have no idea how to fix the Maven dependency. Any help will be enthusiastically accepted!
Seems like the org.openqa.selenium.interactions package, including the Actions class, got moved to selenium-remote-driver.
You can either add a dependency to selenium-remote-driver directly, or, even simpler, add a dependency to to selenium-java (that depends on selenium-chrome-driver which in turn depends on selenium-remote-driver). I would try to go with the latter option as this should allow you to get rid of a lot of other explicit dependencies as well.

Missing artifact error when adding a Maven dependency

I am not familiar with maven but I need to add a jnativehook dependency in a Java/Jersey project. I tried to add this dependency in my pom.xml
<dependency>
<groupId>com.1stleg</groupId>
<artifactId>system-hook</artifactId>
<version>2.0.3</version>
</dependency>
But I get an error on Eclipse
Missing artifact com.1stleg:system-hook:jar:2.0.3
According this, it should be:
<dependency>
<groupId>com.1stleg</groupId>
<artifactId>jnativehook</artifactId>
<version>2.0.3</version>
</dependency>
instead of
<dependency>
<groupId>com.1stleg</groupId>
<artifactId>system-hook</artifactId>
<version>2.0.3</version>
</dependency>
Hope it helps!

Eclipse Maven Dependency issue

I have maven-depenencies folder which lists over 50+ jars I need for compile and testing on my local. In addition POM.xml have specific (see snippet) which lists the dependencies I wanted in "target/final_build.jar". I do not want rest of maven - dependencies I can see on eclipse IE. I just want following packaged as aprt of final jar..
What is the easy way to accomplish . I tried copy-dependencies but it copied all Maven dependencies and not the 4 listed in pom.xml. More over they are copied over to lib/src folder.
Desired state is to just have 4 dependencies mentioned below are part of "target/outputfile.jar"
<dependencies>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-stream</artifactId>
<version>3.0.3</version>
</dependency>
</dependencies>
Dependencies that are needed for compile/test but not for the application (because the (EE-/JDK-/?-) Container already have this classes) can be specified by the dependency scope provided:
<dependencies>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
<version>3.0.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-stream</artifactId>
<version>3.0.3</version>
<scope>provided</scope>
</dependency>
</dependencies>

Categories