简体   繁体   中英

How to add module dependency to other module in Java Project Intellij

I havr two modules in this project (JavaRESTfulEngine and Models). Java RESTful engine depends on models. 在此处输入图片说明

I added the dependency here: 在此处输入图片说明

But in my JavaRESTfulEngine project I still get reference errors. For example, the Document class is in the Models module, but I cannot find it when trying to import the class in JavaRESTful module: 在此处输入图片说明 The goal is that Models is compiled down to a jar and used in the JavaRESTful project during runtime. Does anything stand out as wrong in my setup? EDIT I changed the scope from compile to provided and it still doesnt work.

You don't have to change the scope of the jars. If you want to use the libraries of the Models module in the JavaRESTfulEngine module, you just have to make sure that each jar you want to reuse from Models has the "Export" check box activated and that the reference to the Models folder is inside the JavaRESTfulEngine module (just like I see you have it in the second photo)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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