xolstice / protobuf-maven-plugin

Maven Plugin that executes the Protocol Buffers (protoc) compiler
https://www.xolstice.org/protobuf-maven-plugin/
Other
232 stars 76 forks source link

Can't access sources. #38

Closed TheMasteredPanda closed 6 years ago

TheMasteredPanda commented 6 years ago

Apache Maven 3.5.0 Java version: 1.8.0_151, vendor: Oracle Corporation Default locale: en, platform encoding: UTF-8 OS name: "linux", version: "4.13.0-kali1-amd64", arch: "amd64", family: "unix" IDE: IntelliJ Ultimate 2017.2.6

Problem: The sources are generated but I cannot use them. For example, I can't extend the base implementation when making a new service. I really don't know what the problem is.

My .proto file:

syntax = "proto3";

package me.tmp.grpc.server.generated;

option java_multiple_files = true;

service GRPCTestService {
    rpc greet(HelloRequest) returns (HelloResponse);
}

message HelloRequest {
    string name = 1;
}

message HelloResponse {
    string message = 1;
}

The output: https://gist.github.com/TheMasteredPanda/13139c44536d32d9a36614b150639b20

sergei-ivanov commented 6 years ago

I am not sure that I understand the problem. Are sources being generated or not?

TheMasteredPanda commented 6 years ago

Hey, @sergei-ivanov, apologizes for the confusion. The sources are being generated, I just cant access them.

TheMasteredPanda commented 6 years ago

Proof that they have been generated: https://gyazo.com/cca1e51bdede7fb5b2c84df7d78c42e9 My pom.xml too: https://gist.github.com/TheMasteredPanda/55d55b1baee53e21eb573b83180efd30

Thing is I cannot extend any of these generated classes. I really don't understand why.

sergei-ivanov commented 6 years ago

Looks like the output folders are not marked as source folders in IDEA. Normally it is quite good at automatically detecting them, but sometimes needs a nudge. Try either running "refresh" action in the maven projects window, or "detect source directories" (or whatever it is called, there is a button on the maven panel toolbar). Check that there is automatic detection of generated sources configured in maven settings in IDEA. Failing all that, right-click on the directories in the project tree and select "mark directory as > source folder".

TheMasteredPanda commented 6 years ago

That done it, thanks @sergei-ivanov!