0
votes

I have a maven project, which has a library (hello1.jar), that I add with IDEA. In this jar file I have the class ru.training.Hello1. In project I have the class Hello2, which contains field Hello1 hello1. When I try to compile the project with maven lifecycle, I get an error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile (default-compile) on project Learning: Compilation failure: Compilation failure:

[ERROR] /C:/Projects/Learning/src/main/java/reflection/Hello2.java:[3,19] package ru.training does not exist

[ERROR] /C:/Projects/Learning/src/main/java/reflection/Hello2.java:[7,13] cannot find symbol

[ERROR] symbol: class Hello1

What can I do to fix this error?

1
Add the jar in your pom file..not in the IDE....khmarbaise
Thank you, friend. I use this to add local jar to pom: stackoverflow.com/questions/4955635/…tomasomsk

1 Answers

0
votes

In this case you need to add local jar file to local repository and then compile the project. How to add local jar I have read here: How to add local jar files to a Maven project?