IntelliJ IDEA: How to import a project that has Java and JavaScript modules?

Sasha Shpota :

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.

I can of cource import server as a separate project and import webapp as a separate project but it is inconvenient. I want to have them all in the same workspace.

Question: How to import a Java + JavaScript project to IntelliJ IDEA?

vbezhenar :

Create empty project without any modules in the root directory and then add two modules (first is gradle module, second is web application module). Another approach is to put you web application inside your Java application (your server is supposed to serve frontend assets anyway).

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=25265&siteId=1