Reputation: 9616
Environment: Gradle <= 2.5, STS <= 3.7 or Eclipse version <= Luna
It is annoying to work with Gradle and Eclipse (or STS) that you have to keep performing "Gradle Refresh" or "Gradle RefreshAll" numerous time in the development workflow.
Here are the scenarios when you MUST perform Gradle Refresh OR remove the projects and "re-import/aka Build Model".
1) You perform Git pull and receive changes to dependencies. Many times the changes coming in are compile time dependencies or testRuntime
dependencies.
In these cases you are confronted with nasty compilation errors. Which are gone ONLY after you perform "Gradle Refresh All/Gradle Refresh Dependency".
2) You add new dependencies yourself to your build.gradle during development and you need your code to
3) JAXB Plugins for schema compilation - Gradle JAXB Plugin- when used you must call xjc before the source folders are created. I got some help using compileJava.dependsOn xjc
as per here but still leaves far from desired.
If a developer changes the xsd and Java sources that references the JAXB classes that the xjc
would generate.
You now must first call xjc
or compileJava
and then you MUST call Gradle Refresh Sources
by right clicking on the schema project.
Another more than year old thread showing same frustration as me.
Upvotes: 0
Views: 121
Reputation: 3957
Answer to slightly different aspect of your question. You asked about "What Gradle task gets invoked by the gradle-eclipse plugin". You do have this under control. When you import the project using the wizard, you can specify tasks to execute before and after import. These same tasks are also executed upon performing a 'Refresh All'.
Upvotes: 0
Reputation: 3957
This probably doesn't handle all your cases, but there is an option you can enable to "Automatically Refresh Dependencies" when .gradle file changes.
Some things to know about the limitations of this feature:
refreshes 'Gradle Dependencies' in the 'managed' container only. So 'Dependency management has to be enabled for it to work'.
doesn't execute tasks, it only refreshes the dependencies in the container and nothing else.
Upvotes: 1