[英]IntelliJ IDEA: How to import a project that has Java and JavaScript modules?
I have a mono-repository with both back end and front end code.我有一个包含后端和前端代码的单一存储库。 The file structure looks like this:
文件结构如下所示:
├── server
│ ├── gradle
│ ├── src
│ │ ├── main
│ │ │ └── java # back end code
│ │ └── test
│ │ └── java # back end tests
│ ├── build.gradle
│ └── gradlew
├── webapp
│ ├── public
│ ├── src
│ │ └── # js app files
│ ├── package.json
│ └── package-lock.json
└── Dockerfile
Problem: if I import the project from its root, it doesn't recognize Gradle dependencies (all classes are red), and the webapp
module is not imported at all.问题:如果我从根目录导入项目,它无法识别 Gradle 依赖项(所有类都是红色的),并且根本不会导入
webapp
模块。
I can of cource import server
as a separate project and import webapp
as a separate project but it is inconvenient.我当然可以将
server
作为单独的项目导入,并将webapp
作为单独的项目导入,但这很不方便。 I want to have them all in the same workspace.我想让它们都在同一个工作区中。
Question: How to import a Java + JavaScript project to IntelliJ IDEA?问题:如何将 Java + JavaScript 项目导入 IntelliJ IDEA?
Create empty project without any modules in the root directory and then add two modules (first is gradle module, second is web application module).在根目录下创建一个没有任何模块的空项目,然后添加两个模块(第一个是gradle模块,第二个是web应用模块)。 Another approach is to put you web application inside your Java application (your server is supposed to serve frontend assets anyway).
另一种方法是将 Web 应用程序放在 Java 应用程序中(无论如何,您的服务器应该为前端资产提供服务)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.