0

I'm a newbie IntelliJ's user therefore I've met some problems.

For example, I have 2 maven project: A & B. Project B is addition source of project A. In Eclipse, I can add source project B into project A by: Java Build Path (project A) -> Source (tab) -> Link Source ... So that I can use every Class in project B from project A.

In IntelliJ, I've imported project B by this way:

Project Settings -> Modules -> Button (+) -> Import module from external model (select Maven type) -> Next till Finish.

In order to add module B into module A:

In tab Dependencies of module A -> Click Button (+) -> 3. Module Dependency -> Select module B from module list -> Apply -> Ok.

I think this way can help me to link addition source of B into project A (similar to Eclipse).

However, when I added new (or modified) a class in project B and compile project A, I received the error ClassNotFoundException from project A. I've tried to compile and make both project B & A, but the exception still remained.

I don't know where I was wrong. Please help me.

1 Answer 1

0

In the project structure, click on the A module, go to the Dependencies tab and click the + button beside the dependencies list. click on the Module Dependency and select the module B. this must resolve your problem.

8
  • Hi @Hossein, your way is similar what I described above !? It still didn't resolve my problem
    – Leo Le
    Jul 28, 2015 at 12:20
  • check your dependencies for the Module A, does module B exists in it?
    – Hossein
    Jul 29, 2015 at 5:38
  • Module B exists in module A, surely, and module B's scope is Compile in module A.
    – Leo Le
    Jul 29, 2015 at 7:44
  • The exception you get is about a B class not found in A? or vice versa?
    – Hossein
    Jul 29, 2015 at 8:16
  • A B's class not found in A when compiled project A even though I can use (Command + Click) to go to a class B from class A. That's so weird @Hossein
    – Leo Le
    Jul 29, 2015 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.