Skip to content

Development mode: read resources from src/main/resources on disk, not the classpath output folder #69

Description

@hugithordarson

Problem

In development the resource loader only uses the classpath source. Under Eclipse the classpath is the output folder (target/classes), which Eclipse populates by copying from src/main/resources during its build. That copy only happens when Eclipse notices a change — an edit in its own editor or a workspace refresh. Edits made on disk by anything else (another editor, a script, an AI agent) leave target/classes stale, so templates and webserver resources appear not to change until a refresh/rebuild is triggered (today: the Parslips dev server's /refreshProject).

It isn't compilation, it's a resource copy step that never fires.

Proposal

NGResourceLoader.FileSystemDirectoryResourceSource already exists but isn't wired in. When running in development mode from a project directory (WOUserDirectory is known), have NGDevelopmentPlugin register a filesystem source pointing at src/main/resources ahead of the classpath source for the app namespace, so component templates and webserver resources are read live from disk on every request.

Considerations:

  • Only for the app namespace / the project being developed; plugins and frameworks keep the classpath source.
  • Fall back to the classpath source when src/main/resources doesn't exist (bundled deployments).
  • NGComponentDefinition caches parsed templates (_cachedTemplate); in development the cache needs to be invalidated (by mtime, or simply not cached) for this to take effect.
  • Same applies to whoa-style webserver-resources served via /nr/….

Benefit

Templates and stylesheets go live on save for everyone — humans and agents — with no Eclipse round-trip, retiring a whole class of "why don't I see my change" moments. Parslips' /refreshProject would still be needed for Java changes (hot-swap), but not for templates or CSS.

Noted while working on the whoacommunity redesign, 2026-09-02.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions