Attempt to create Apex class results in error "Failed to find a builder for directory 'src/classes'"

Issue #2629 resolved
Alan Birchenough created an issue

I seem to be getting this error only in one particular project. I invoke the “Create Apex Class” command, fill in a class name and select a template, e.g., Unit Test Class, and hit return, whereupon an error dialog appears, displaying the above message.

Please let me know what additional information would be helpful, and I’ll endeavor to provide it.

Comments (10)

  1. Alan Birchenough reporter
      <div class="preview-container wiki-content"><!-- loaded via ajax --></div>
      <div class="mask"></div>
    </div>
    

    </div> </form>

  2. Scott Wells repo owner
    • changed status to open

    Hi, Alan. That would happen if the directory src/classes is not under a configured source root for an IDE module that's been configured for IC2. Can you please attach the .iml file for review?

  3. Scott Wells repo owner

    Thanks. I think I see the problem here:

        <content url="file://$MODULE_DIR$">
          <sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
          <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
        </content>
    

    I think it’s because the source roots are nested. Yes, it should technically work, but I think there might be an issue when such nesting exists. You can either close the project and remove the first sourceFolder entry from the .iml file, then reopen the project, or if you’d prefer, you can remove it via Illuminated Cloud | Configure Module | Project Structure.

    Let me know if that doesn’t do the trick.

  4. Scott Wells repo owner

    That looks correct, yes. Did you have to make any modifications to have it look that way? Are things working now? If not, has the .iml file changed such that it doesn’t includes two sourceFolder entries, one that is the parent of the other?

  5. Scott Wells repo owner

    I’m not following. Do you mean in terms of the organization of your project directory structure or something IC2-specific? And you can add other source root directories if that makes sense. Just don’t add nested source roots.

  6. Alan Birchenough reporter

    I did not make any changes to any *.iml files. The screenshot shows what the structure is depicted as within IC2 Project Structure. I am still unable to create any Apex classes.

    My comment on the pages and triggers directories was simply that I wouldn’t expect them to show up in the project structure outside of src. I am certainly not aware of having done anything to make that happen.

    Since this project seems a bit hosed up, and I have all my sources in Git, I created a new project for the same OAuth connection, using “New Project From Version Control”. Everything seems to be working well. Since this new project does seem to be working, we can close this ticket if you like. I do find it unsatisfactory that I can’t diagnose what was going on with the other project, but I guess I should probably live with that and move on.

  7. Scott Wells repo owner

    Yeah, let's just close this. It's hard to say what might have been going on, but if a new project resolves the issue, it probably doesn't make much sense to continue troubleshooting the old one...unless, of course, you see this behavior again.

  8. Log in to comment