Using gRPC generated Java classes with IntelliJ

The Maven gRPC plugin generates the needed Java classes files from the .proto file. Taking this project for example:

It contains the plugin to generate the class files:


If we open the project in IntelliJ, we can see there are classes missing:

Because these classes are generated during the compiling phase, so we can run the Maven command to generate the classes:

$ mvn install

We can see the Java classes are generated in the target directory:

Then we can set the above directories as source directory like this:

After these two directories are marked as source directory, we can see the color of these two directories are changed to blue, and the classes can be referred correctly:

Update: Or we can directly set the generated source director like this:

My Github Page:

Powered by Jekyll and Theme by solid

If you have any question want to ask or find bugs regarding with my blog posts, please report it here: