Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntelliJ IDEA doesn't recognize classes generated from proto files in a Gradle project #13882

Closed
Shpota opened this issue Dec 14, 2020 · 7 comments
Labels
area/gradle Gradle area/kotlin kind/bug Something isn't working triage/invalid This doesn't seem right

Comments

@Shpota
Copy link

Shpota commented Dec 14, 2020

Describe the bug
IntelliJ IDEA doesn't recognize classes generated from proto files in a Gradle project.

Expected behavior
Quarkus gRPC plugin should update IDEAs source sets so that it could see the generated classes automatically (for instance, like the protobuf-gradle-plugin does it).

Actual behavior
IntelliJ IDEA doesn't recognize classes generated from proto files in a Gradle project.

To Reproduce

Steps to reproduce the behavior:

  1. Generate a Qurkus Gradle project with the 'io.quarkus:quarkus-grpc' dependency.
  2. Add a valid proto file definfing a gRPC service into src/main/proto.
  3. Build the project and check that the code has been generated to build/classes/java/quarkus-generated-sources/grpc.
  4. Add a Java class with an import of a class from the generated sources.

Environment (please complete the following information):

  • Output of uname -a or ver: 20.1.0 Darwin Kernel Version 20.1.0: Sat Oct 31 00:07:11 PDT 2020; root:xnu-7195.50.7~2/RELEASE_X86_64 x86_64
  • Output of java -version:
openjdk 15.0.1 2020-10-20
OpenJDK Runtime Environment (build 15.0.1+9-18)
OpenJDK 64-Bit Server VM (build 15.0.1+9-18, mixed mode, sharing)
  • GraalVM version (if different from Java): -
  • Quarkus version or git rev: 1.10.3.Final
  • Build tool (ie. output of mvnw --version or gradlew --version):
Gradle 6.5.1

Build time:   2020-06-30 06:32:47 UTC
Revision:     66bc713f7169626a7f0134bf452abde51550ea0a

Kotlin:       1.3.72
Groovy:       2.5.11
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          15.0.1 (Oracle Corporation 15.0.1+9-18)
OS:           Mac OS X 10.16 x86_64

Additional context
The work around is to manually specify an additional source set in Gradle:

sourceSets {
    main {
        java {
            srcDirs 'build/classes/java/quarkus-generated-sources/grpc'
        }
    }
}

But I tried many things and wasted a lot of time until I found how to fix it. It is important to have a ready-to-run project after project generation.

@Shpota Shpota added the kind/bug Something isn't working label Dec 14, 2020
@ghost ghost added area/gradle Gradle area/kotlin labels Dec 14, 2020
@ghost
Copy link

ghost commented Dec 14, 2020

/cc @evanchooly, @glefloch, @quarkusio/devtools

@glefloch
Copy link
Member

Is it a kotlin project? I have a fix that register the generated output to the gradle compile task.
I'm looking at removing the sub directory in the generated folder.

@Shpota
Copy link
Author

Shpota commented Dec 14, 2020

@glefloch the issue exists in both Java and Kotlin projects.

@galiagacandia
Copy link

In intellij idea it is necessary to perform the following configuration

image

image

image

I hope this helps.

@michalszynkiewicz
Copy link
Member

Isn't it enough to reload the project? That's how it works with maven projects, IntelliJ doesn't pick up new folders of generated sources until the project is reloaded

@geoand
Copy link
Contributor

geoand commented Jul 13, 2022

Closing as we never got feedback

@geoand geoand closed this as not planned Won't fix, can't repro, duplicate, stale Jul 13, 2022
@geoand geoand added the triage/invalid This doesn't seem right label Jul 13, 2022
@alanLJ
Copy link

alanLJ commented Aug 31, 2023

In intellij idea it is necessary to perform the following configuration

image

image

image

I hope this helps.

That's so great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gradle Gradle area/kotlin kind/bug Something isn't working triage/invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

6 participants