Getting package org.assertj.core.api does not exist even though I am specifying in my pom, version 3.6.2 while using JDK 1.8
Asked Answered
A

1

6

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);
Arvie answered 27/1, 2019 at 6:37 Comment(3)
Can we see that section of your pom?Caecilian
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!!)Arvie
@PraNuta please provide your pom before and after change so that future readers like me can be benefitted from this.Franklynfrankness
A
11

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!!)

Arvie answered 7/2, 2019 at 19:22 Comment(3)
Any library which is used for testing like testNg, assertJ, hamcrest is likely to cause the error because maven central repo sets the <scope> as test by default.Outlay
I have literally spent over two or three weeks trying every imaginable permutation. Thank-you, thank-you, thank-you!!!Geriatric
This resolves the problem as a workaround, but does not explain the problem in detail. In my case maven install is working fine, so it must be a problem with intellij still 4 years laterStipend

© 2022 - 2024 — McMap. All rights reserved.