5

I am having problem with Eclipse using Maven. I am getting package org.assertj.core.api does not exist even though I am specifying it in my pom.xml, as version 3.6.2 while using JDK 1.8. How to overcome it ? mvn clean install is failing.

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project com.transunion.qa.datahub.ui.java.bdd.serenity: Compilation failure: Compilation failure:

[ERROR] /Users/pnutala/eclipse-photon-workspace/com.transunion.datahub.ui.qc.java.bdd.serenity/src/main/java/com/transunion/qc/steplibrary/datahub/DeCoherentUser.java:[7,35] package org.assertj.core.api does not exist

[ERROR] /Users/pnutala/eclipse-photon-workspace/com.transunion.datahub.ui.qc.java.bdd.serenity/src/main/java/com/transunion/qc/steplibrary/datahub/DeCoherentUser.java:[7,1] static import only from classes and interfaces [ERROR] -> [Help 1]

Tried Mvn clean install, and verify unsuccessfully.

 import static org.assertj.core.api.Assertions.assertThat;

 @Step
 public void landedOnListPage(String expectedTotle) {

assertThat(currentListPage.getTitle()).containsIgnoringCase(expectedTotle);
Selaron
  • 6,105
  • 4
  • 31
  • 39
PraNuta
  • 629
  • 3
  • 12
  • 33
  • 2
    Can we see that section of your pom? – Todd Jan 27 '19 at 18:01
  • Thanks for the reply. It got solved very trivially, by removing the 'test' scope in the pom file for the dependency(this is what I remember after few days!!) – PraNuta Feb 07 '19 at 19:21
  • 1
    @PraNuta please provide your pom before and after change so that future readers like me can be benefitted from this. – Meraj al Maksud Dec 25 '20 at 15:59

1 Answers1

10

It got solved very trivially, by removing the 'test' scope in the pom file for the dependency(this is what I remember after few days!!)

PraNuta
  • 629
  • 3
  • 12
  • 33
  • 1
    Any library which is used for testing like testNg, assertJ, hamcrest is likely to cause the error because maven central repo sets the as test by default. – MasterJoe Mar 05 '20 at 20:51
  • 1
    I have literally spent over two or three weeks trying every imaginable permutation. Thank-you, thank-you, thank-you!!! – A. Rick Sep 03 '20 at 21:40