Multimodule Maven project in Intellij

扶醉桌前 提交于 2019-12-22 13:49:35

问题


Issue: For some reason my main application can't import classes from other modules.

Also I don't see the compiled output of Data and Remote modules getting included in main Main:war: exploded under WEB-INF/classes under Module Settings (IntelliJ)

Main application

<groupId>com.example.entitlement</groupId>
<artifactId>service</artifactId>
<version>1.0-SNAPSHOT</version>
<modules>
    <module>Data</module>
    <module>Remote</module>
</modules>
<packaging>pom</packaging>

Data Module

<parent>
    <artifactId>service</artifactId>
    <groupId>com.example.entitlement</groupId>
    <version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>data</artifactId>

Remote Module

<parent>
    <artifactId>service</artifactId>
    <groupId>com.example.entitlement</groupId>
    <version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>remote</artifactId>

Edit

I've added dependencies as suggested.

    <dependency>
        <groupId>com.example.entitlement</groupId>
        <artifactId>data</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>com.example.entitlement</groupId>
        <artifactId>remote</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>

Edit

My directory structure

来源:https://stackoverflow.com/questions/55569601/multimodule-maven-project-in-intellij

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!