Skip to content

exec writes javasource/<module>/actions/<Name>.java for create java action but prints only "Created java action", so the file is easy to leave uncommitted #1634

Open

Description

@AlvinnYeo

Command: exec with create java action ... as $$ ... $$ · mxcli: v0.27.0 · Mendix: 11.14.0 · Companion: MendixMau/mxcli-project-toolkit#540 (toolkit commit guidance omits javasource/)

Summary

create java action stores the action in the model and writes its body to
javasource/<module>/actions/<Name>.java. The exec output names only the model element:

$ mxcli exec ja.mdl -p <app>.mpr
Created module: Probe
Created java action: Probe.JA_Hello
$ git status --short
 M <app>.mpr
?? javasource/probe/
?? mprcontents/...

A workflow that commits "the model" (<app>.mpr plus mprcontents/) leaves the .java behind. The model still
builds locally, because the file is on disk. A clone from git gets a model that references an action with no body
file, or an empty stub, and the logic is gone. Nothing in the output hints that a file outside the model was written.

Reproduce

mxcli new JA --version 11.14.0 --theme none --layout none --skip-init --skip-build
cd JA && git init -q && git add -A && git commit -qm base
cat > ../ja.mdl <<'EOF'
mdl 1;
create module "Probe";
create java action "Probe"."JA_Hello" () returns String
as $$
return "hi";
$$;
EOF
mxcli exec ../ja.mdl -p JA.mpr
git status --short        # ?? javasource/probe/   (the body, untracked)

Expected

The output says which files outside the .mpr it wrote, so the person or script committing can stage them.

Suggested fix (ranked)

  1. Print each source file written, as its own line:
    Wrote javasource/probe/actions/JA_Hello.java (Java action body; commit it with the model).
    The same applies to JavaScript actions and anything else exec writes beside the model.
  2. A summary line at the end of a run that wrote such files:
    Files written outside the model: 1 (javasource/). Stage them with the .mpr.
  3. Optionally, exec --json lists them, so wrappers can stage them without parsing text.

How to retest

The reproduction above: after the fix, the exec output names javasource/probe/actions/JA_Hello.java.

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