简体   繁体   English

intellij的多个模块项目

[英]Multiple module projects with intellij

I have 2 projects, ProjectA and ProjectB. 我有2个项目,ProjectA和ProjectB。 ProjectB is a standalone project and ProjectA is dependent on ProjectB. ProjectB是一个独立的项目,而ProjectA依赖于ProjectB。 Of course the pom in ProjectA has the dependency of ProjectB as follow: 当然,ProjectA中的pom具有ProjectB的依赖关系,如下所示:

 <overlays>
        <overlay>
            <groupId>ProjectB</groupId>
            <artifactId>ProjectBwar</artifactId>
        </overlay>
    </overlays>

... ...

 <dependency>
        <groupId>ProjectB</groupId>
                <artifactId>ProjectBwar</artifactId>
                <version>ProjectBVersion</version>
                <type>war</type>
</dependency>

When working with only ProjectA, everything is fine. 当仅使用ProjectA时,一切都很好。 Once I import module of ProjectB into the same project, Intellij is importing it fine but it's still using the maven dependency on the build and I'm unable to do any testing on changes done in ProjectB. 将ProjectB的模块导入到同一项目后,Intellij可以很好地导入它,但是它仍使用对构建的maven依赖关系,并且我无法对ProjectB中所做的更改进行任何测试。 Is there a way to tell Intellij to not use the maven dependency and instead use the module I have imported? 有没有办法告诉Intellij不要使用maven依赖,而要使用我导入的模块? I've tried going into the project structure, but I'm unsure of where to go and what to change. 我已经尝试过进入项目结构,但是不确定要去哪里以及要更改什么。 Any help would be appreciated! 任何帮助,将不胜感激! Thanks! 谢谢!

Add your library module as a project dependency, and any changes to your library will be visible in your project immediately. 将您的库模块添加为项目依赖项,对库的任何更改将立即在您的项目中可见。 Assuming you have both your project and library modules within your IntelliJ project, go to: 假设您的IntelliJ项目中同时包含项目和库模块,请转到:

File > Project Structure > Modules > select your project module > Dependencies > + > Module Dependency > select your library module

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM