Intellij-idea - module dependency not working in maven multimodal project

Multi Module Maven project configured in Intellij. There are two modules - general and service. the general dependency is added to the pom.xml of the service module. mvn clean install

successful, but Intellij shows compilation error when importing class into shared module into service module class.

I have tried a variety of settings, such as the reimport, the Rebuild, the Synchronize, mvn clean install

, mvn -U idea:idea

. But nobody works.

Finally, it works after manually adding a module's Dependency tab from the Dependencies tab in the Project Navigator window.

How can I configure Intellij to automatically add module dependencies?

Below is the relevant code.

pom.xml of the common module:

<project ...>

<modelVersion>4.0.0</modelVersion>

<name>common</name>
<groupId>myproject</groupId>
<artifactId>common</artifactId>
<version>1.0</version>
<packaging>jar</packaging>

...

      

pom.xml service module

...

<dependencies>
    <dependency>
        <groupId>myproject</groupId>
        <artifactId>common</artifactId>
        <version>1.0</version>
        <type>jar</type>
    </dependency>

...

      

class com.common.Customer common module.

package com.common;

public class Customer {
...
}

      

the com.service.CustManager class of the service module.

package com.service;

import com.common.Customer; // getting error in Itellij at this line.

public class CustManager {
...
}

      

+3
intellij-idea maven


source to share


No one has answered this question yet

Check out similar questions:

1011
How do I add local jar files to a Maven project?
478
IntelliJ Inspection gives "Cannot resolve symbol" but still compiles the code
442
Correct way to add external jars (lib / *. Jar) to IntelliJ IDEA project
382
IntelliJ - convert Java project / module to Maven project / module
176
Import Maven dependencies into IntelliJ IDEA
75
Maven package works but Intellij build fails
five
How to create imported maven project in Intellij IDEA 11?
2
intellij multi module project add module as dependency, not jar
0
intellij - maven project: Unsatisfactory dependencies
-1
Maven solutions for dependencies in a multi-module project



All Articles
Loading...
X
Show
Funny
Dev
Pics