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

Add apt generated source folder for Eclipse in build.gradle #9134

Closed
1 task done
jsm174 opened this issue Jan 28, 2019 · 5 comments · Fixed by #9468
Closed
1 task done

Add apt generated source folder for Eclipse in build.gradle #9134

jsm174 opened this issue Jan 28, 2019 · 5 comments · Fixed by #9468
Assignees
Milestone

Comments

@jsm174
Copy link
Contributor

jsm174 commented Jan 28, 2019

Overview of the feature request

I use Eclipse as my IDE. When pulling in JHipster microservices using gradle import, I have to add the apt generated source folder as per #2: https://www.jhipster.tech/configuring-ide-eclipse-gradle/

Anytime you refresh the gradle build, this entry gets lost. After doing this a million times, it is now getting old. :)

I'm not a gradle expert, but I tried adding a sourceSets entry in build.gradle and it works great:

idea {
  module {
    excludeDirs += files('node_modules')
  }
}

eclipse {
  sourceSets {
    main {
      java {
        srcDir 'build/generated/source/apt/main'
      }
    }
  }
}

If this seems correct, (or if there is a better way), I can make a PR.

Motivation for or Use Case

See Above

Related issues or PR
  • Checking this box is mandatory (this is just to show you read everything)
@pascalgrimaud
Copy link
Member

@atomfrede : are you ok with that ?

@atomfrede
Copy link
Member

Looks ok, but @jsm174 are you sure that configuration doesn't set the apt directory as only source folder in eclipse?

@atomfrede
Copy link
Member

Is the configuration not apt eclipse plugin not sufficient? (Sorry not an eclipse user) https://github.com/tbroyer/gradle-apt-plugin/blob/v0.20/README.md#eclipse

@atomfrede
Copy link
Member

I will try to find some time and check it. I think it would be better to set

eclipse {
  sourceSets {
    main {
      java {
         srcDirs += ["build/generated/source/apt/main"]
      }
    }
  }
}

@jsm174 Which eclipse version are you using? I assume you are using the buildship plugin?

@jsm174
Copy link
Contributor Author

jsm174 commented Feb 7, 2019

@atomfrede

Eclipse 4.9.0.v20180906-1121
Buildship 2.2.1v20180125-1441

I modified to srcDirs += and that continues to work.

If you Import an Existing Gradle Project (no build directory), the entry will not be in the Java Build Path. You need to:

  1. Gradle Tasks view --> project --> build --> classes
  2. Right click on the project and select Refresh
  3. Right click on the project and select Gradle -> Refresh Gradle Project

Regardless of above, it's still better than having to manually add the path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants