I'm at university and I have to submit a project. I'm having problems with Assertj and JUnit when importing. I'll leave below some images of my problem.
I'll really appreciate if someone could help me! Thank you!
I'm at university and I have to submit a project. I'm having problems with Assertj and JUnit when importing. I'll leave below some images of my problem.
I'll really appreciate if someone could help me! Thank you!
I don't know why but sometimes not including scope will make it work.
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.22.0</version>
<!--<scope>test</scope> --> <!-- I have commented this line out and it worked -->
</dependency>
You'll need to get both the junit and assertj jar files added to your class path. You can either do this within your IDE manually (Intellij includes the junit library, but you'll have to download assertj seperately and add them as dependencies as outlined here), or by using a build system that downloads dependencies from a central repository, like maven. You can then get intellij to use your pom.xml
(maven build configuration), so everything can still be run from within your IDE.
A trivial pom might be something like the following:
<project>
<groupId>com.mycompany</groupId>
<artifactId>my-project</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<!-- use 3.1.0 for Java 8 projects -->
<version>2.1.0</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>