| name | idempiere-cli-add-component |
| description | Add new components or modules to an existing iDempiere plugin using idempiere-cli. Use when the user wants to add a callout, process, event handler, form, or other component to their plugin. |
iDempiere CLI - Add Component
This skill guides you through adding new components and modules to an existing iDempiere plugin using idempiere-cli add.
Workflow
- Navigate to plugin directory:
cd into the plugin root (where META-INF/MANIFEST.MF exists).
- Choose component type: Select from 16+ available component types.
- Run add command: Execute
idempiere-cli add <type> <ClassName>.
Component Commands
Business Logic
idempiere-cli add callout MyCallout
idempiere-cli add process MyProcess
idempiere-cli add process-mapped MyMappedProcess
idempiere-cli add event-handler MyEventHandler
User Interface
idempiere-cli add zk-form MyForm
idempiere-cli add zk-form-zul MyZulForm
idempiere-cli add listbox-group MyGroupForm
idempiere-cli add wlistbox-editor MyEditorForm
Reports
idempiere-cli add report MyReport
idempiere-cli add jasper-report MyJasperReport
Validators and Extensions
idempiere-cli add window-validator MyWindowValidator
idempiere-cli add rest-extension MyResource
idempiere-cli add facts-validator MyFactsValidator
Model and Testing
idempiere-cli add model --table=MY_Table
idempiere-cli add test MyCalloutTest
idempiere-cli add base-test
Module Commands (Multi-module projects)
idempiere-cli add plugin org.mycompany.project.reports
idempiere-cli add fragment --host=org.adempiere.ui.zk
idempiere-cli add feature
idempiere-cli add maven-wrapper
Common Options
| Option | Description |
|---|
--to=<path> | Target plugin directory (if not current dir) |
--dir=<path> | Project directory (for module commands) |
--prompt=<text> | Describe what the component should do (used for AI generation) |
The --prompt option is available on all component commands (callout, process, event-handler, zk-form, zk-form-zul, listbox-group, wlistbox-editor, report, jasper-report, window-validator, rest-extension, facts-validator, base-test, process-mapped). When an AI provider is configured, the prompt is sent as ## User Instructions to the AI model, which generates context-aware code. Without AI, the standard template is used as fallback.
How It Works
When you run idempiere-cli add <type> <ClassName>:
- Detects plugin structure: Reads
META-INF/MANIFEST.MF to find plugin ID and package.
- Generates Java source: Creates the component class from built-in templates.
- Registers OSGi service: Adds
OSGI-INF/<component>.xml descriptor if needed.
- Updates MANIFEST.MF: Adds
Service-Component header entries.
- Reuses shared infrastructure: Detects existing factories/activators and reuses them.
AI-Powered Generation
For richer code generation, idempiere-cli add supports AI-powered scaffolding when an AI provider is configured:
idempiere-cli config init
idempiere-cli config set ai.provider anthropic
idempiere-cli config set ai.apiKey sk-ant-...
idempiere-cli add callout OrderDateCallout
idempiere-cli add callout OrderDateCallout \
--prompt="Validate that DateOrdered is not in the future, show warning if weekend"
AI scaffolding uses SKILL.md files from configured skill sources and the --prompt user instructions to generate more complete, context-aware code. Without AI configured, the --prompt option is silently ignored and standard templates are used.
Example Usage
Adding a callout to validate order dates
cd org.mycompany.sales
idempiere-cli add callout OrderDateCallout
This creates:
src/org/mycompany/sales/callout/OrderDateCallout.java
OSGI-INF/org.mycompany.sales.callout.OrderDateCallout.xml
- Updates
META-INF/MANIFEST.MF with Service-Component entry
Adding a process to an existing plugin
idempiere-cli add process GenerateInvoices --to=/path/to/org.mycompany.sales
Adding model classes from database
idempiere-cli add model --table=MY_Custom_Table \
--db-host=localhost --db-port=5432 \
--db-name=idempiere --db-user=adempiere --db-pass=adempiere
Notes
- Run
add commands from within the plugin directory (where META-INF/MANIFEST.MF exists).
- The CLI auto-detects the plugin's base package from the plugin ID.
- Shared components (factories, activators) are reused across multiple
add calls.
- Component types
process and process-mapped differ in registration: process creates its own factory, process-mapped uses the global MappedProcessFactory (compatible with 2Pack import/export).