Sergio
Sergio

Reputation: 3387

Running Arquillian tests with Maven dependencies in IntelliJ Idea

When deploying an Arquillian test with Intellij using pom dependencies like:

    File[] libs = Maven.resolver().offline()
                                  .loadPomFromFile("pom.xml")
                                  .importRuntimeDependencies()
                                  .resolve().withTransitivity().asFile();

The test run just fine in other IDEs, but with IntelliJ, there is an error that does not let execute the test properly.

Upvotes: 0

Views: 2297

Answers (1)

Sergio
Sergio

Reputation: 3387

Go to Edit Configurations (under Run menu), select Defaults branch and then JUnit. You can see that Working directory is set to project’s directory. That’s why pom.xml could not be found in this location. Fortunately it can be changed either to MAVEN_REPOSITORY or to MODULE_DIR and the latter is exactly what you want. Changing that and saving it in defaults makes the issue above disappear.

Now you can run your tests from IntelliJ even if you have maven dependencies to be included in your @Deployment archive.

As seen here: http://michalostruszka.pl/blog/2012/10/24/arquillian-tests-with-maven-deps-intellij/

Upvotes: 1

Related Questions