[GRADLE-2574] "Unable to resolve class" after moving a class from src/main/groovy to src/main/java Created: 27/Nov/12 Updated: 10/Feb/17 Resolved: 10/Feb/17 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | ||
Reporter: | Gradle Forums | Assignee: | Unassigned |
Resolution: | Won't Fix | Votes: | 1 |
Issue Links: |
|
Description |
I moved a couple files from src/main/groovy/ to src/main/java/, followed by changing the associated file suffixes from .groovy to .java. My project would not build until I removed the .gradle/ cache in the project current working directory. The compiler complained that it could not find the files/classes that had moved. Is this to be expected? |
Comments |
Comment by Gradle Forums [ 27/Nov/12 ] |
This shouldn't happen. Can you provide the exact error message, stack trace, etc.? |
Comment by Gradle Forums [ 27/Nov/12 ] |
Here is the error message from my console: /Users/petrovic/Projects/acme/qa/lib/atf-core/geb-browser-parent/geb-dpsbrowser/src/main/groovy/com/acme/qa/dpsbrowser/DPSBrowserImpl.groovy: 162: unable to resolve class ServiceType I will try to reproduce in a test project. If I cannot, this is all I can offer at the moment. |
Comment by Gradle Forums [ 27/Nov/12 ] |
Ok, I am able to reproduce this in a test project. Here is my console output: mb:gradle-rename-enum> find . mb:gradle-rename-enum> gradle -q build mb:gradle-rename-enum> mv -v src/main/groovy/somepackage/SomeEnum.groovy src/main/java/somepackage/SomeEnum.java mb:gradle-rename-enum> gradle -q build 1 error FAILURE: Build failed with an exception.
mb:gradle-rename-enum> rm -rf .gradle/ mb:gradle-rename-enum> gradle -q build # no problems Here is my build script: apply plugin: 'groovy' repositories { dependencies { And here are the source files: An enum that I move from src/main/groovy to src/main/java: package somepackage; public enum SomeEnum { The client code: package somepackage class AScript { def foo() { My Gradle version: gradle -v ------------------------------------------------------------ Gradle build time: Wednesday, September 12, 2012 10:46:02 AM UTC |
Comment by Gradle Forums [ 27/Nov/12 ] |
I re-ran the scenario with Gradle 1.3. It behaves the same as 1.2. |
Comment by Gradle Forums [ 27/Nov/12 ] |
The project on github: [1]https://github.com/ae6rt/gradle-renam... |
Comment by Adam Murdoch [ 27/Nov/12 ] |
Workaround is to run with --rerun-tasks |
Comment by Benjamin Muschko [ 15/Nov/16 ] |
As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub. We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to. Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:
We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle! |
Comment by Benjamin Muschko [ 10/Feb/17 ] |
Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved. |