Difference between revisions of "Antigravity.md"
m |
|||
| (7 intermediate revisions by the same user not shown) | |||
| Line 10: | Line 10: | ||
- **File > Add Folder to Workspace...** , add your other project source folder to your workspace | - **File > Add Folder to Workspace...** , add your other project source folder to your workspace | ||
- **File > Save Workspace As...** to save your workspace | - **File > Save Workspace As...** to save your workspace | ||
| − | - | + | - Add the following properties to "settings" in the save .code-workspace file to prevent unnecessary formatting only changes: |
| − | ``` | + | ```json |
"settings": { | "settings": { | ||
| − | + | "editor.formatOnSave": false, | |
| − | + | "editor.formatOnType": false, | |
| − | + | "editor.formatOnPaste": false, | |
| − | + | "editor.codeActionsOnSave": { | |
| − | + | "source.fixAll": "never", | |
| − | + | "source.organizeImports": "never" | |
| − | + | }, | |
| − | + | "java.configuration.updateBuildConfiguration": "disabled", | |
| − | + | "java.configuration.runtimes": [ | |
| − | + | { | |
| − | + | "name": "JavaSE-17", | |
| + | "path": "/usr/lib/jvm/java-17-temurin-jdk", | ||
| + | "default": true | ||
| + | } | ||
| + | ], | ||
| + | "java.project.resourceFilters": [], | ||
| + | "files.eol": "\n", | ||
| + | "files.trimTrailingWhitespace": false, | ||
| + | "files.insertFinalNewline": false, | ||
| + | "files.trimFinalNewlines": false | ||
} | } | ||
``` | ``` | ||
| + | - Replace `"path": "/usr/lib/jvm/java-17-temurin-jdk"` with your JDK17 path. The default JVM configuration is important for test and remote debugging. | ||
| + | - `"java.project.resourceFilters": []` is to stop antigravity adding the following to .project files: | ||
| + | ```xml | ||
| + | <filteredResources> | ||
| + | <filter> | ||
| + | <id>1774448868880</id> | ||
| + | <name></name> | ||
| + | <type>30</type> | ||
| + | <matcher> | ||
| + | <id>org.eclipse.core.resources.regexFilterMatcher</id> | ||
| + | <arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments> | ||
| + | </matcher> | ||
| + | </filter> | ||
| + | </filteredResources> | ||
| + | ``` | ||
- Add the following to {idempiere source folder}/.git/info/exclude file: | - Add the following to {idempiere source folder}/.git/info/exclude file: | ||
| − | ``` | + | ```text |
.project | .project | ||
.vscode | .vscode | ||
| Line 39: | Line 63: | ||
*.code-workspace | *.code-workspace | ||
``` | ``` | ||
| + | - To ignore changes to tracked .project files: | ||
| + | ```text | ||
| + | git update-index --skip-worktree **/.project | ||
| + | ``` | ||
| + | |||
| + | - To restore tracking of .project files: | ||
| + | ```text | ||
| + | git update-index --no-skip-worktree **/.project | ||
| + | ``` | ||
| + | |||
- To set active target platform, right click on the target definition file (.target file) and select **Reload Target Platform** | - To set active target platform, right click on the target definition file (.target file) and select **Reload Target Platform** | ||
| Line 50: | Line 84: | ||
- `gemini skills install https://github.com/hengsin/idempiere-examples` | - `gemini skills install https://github.com/hengsin/idempiere-examples` | ||
- Install iDempiere skills for Gemini CLI: https://github.com/hengsin/idempiere-skills | - Install iDempiere skills for Gemini CLI: https://github.com/hengsin/idempiere-skills | ||
| − | - Add | + | - Add more source folder to your workspace (File > Add Folder to Workspace...) |
| − | - https://github.com/hengsin/idempiere-mcp | + | - [iDempiere MCP Server](https://github.com/hengsin/idempiere-mcp) |
# What you still need from Eclipse | # What you still need from Eclipse | ||
| Line 66: | Line 100: | ||
- Note that if you use Right Click > Debug PDE Application to launch a launch configuration again, it will overwrite the changes that you have make to the launch.json file. | - Note that if you use Right Click > Debug PDE Application to launch a launch configuration again, it will overwrite the changes that you have make to the launch.json file. | ||
- If there are changes to a .launch file, remove the entry from **launch.json** to recreate it from the latest .launch file. | - If there are changes to a .launch file, remove the entry from **launch.json** to recreate it from the latest .launch file. | ||
| + | - Add `"projectName": "org.adempiere.base"` to enable evaluation of expression in debug (using the **Debug Console**). | ||
| + | - You can use inline comment as instruction to guide the agent to generate code for your need. You can remove the inline comment after you have accept or reject the generated code. | ||
- Automatic build can cause conflict with mvn build. You might want to disable automatic build if you frequently use maven to run build or run unit test. | - Automatic build can cause conflict with mvn build. You might want to disable automatic build if you frequently use maven to run build or run unit test. | ||
- Add **Customizations** rule to guide the agent on the running of mvn build and unit test for iDempiere: | - Add **Customizations** rule to guide the agent on the running of mvn build and unit test for iDempiere: | ||
| − | + | ```text | |
| − | ``` | + | **For running of unit test and integration test using maven** |
| − | **For running of unit test and integration test using maven** | + | * Run from workspace root folder |
| − | * Run from workspace root folder | + | * Set JAVA_HOME to /usr/lib/jvm/java-17-temurin-jdk |
| − | * Set JAVA_HOME to /usr/lib/jvm/java-17-temurin-jdk | + | * mvn integration-test -DskipTests=false -DmaterializeProduct=none -DassembleRepository=none -Dtest=**test class name** |
| − | * mvn integration-test -DskipTests=false -DmaterializeProduct=none -DassembleRepository=none -Dtest=**test class name** | + | * Always run in terminal |
| − | * Always run in terminal | + | ``` |
| − | ``` | ||
| − | |||
- After making changes to MANIFEST.MF, run **Full Build** to resolve build errors. | - After making changes to MANIFEST.MF, run **Full Build** to resolve build errors. | ||
- If you have an IDE or workspace settings that you can't locate the place to change it, try ask the agent to do it for you. | - If you have an IDE or workspace settings that you can't locate the place to change it, try ask the agent to do it for you. | ||
| + | - To debug integration test | ||
| + | - Add the following to `"configurations"` in launch.json: | ||
| + | ```json | ||
| + | { | ||
| + | "type": "java", | ||
| + | "request": "attach", | ||
| + | "name": "Attach by Process ID", | ||
| + | "processId": "${command:PickJavaProcess}", | ||
| + | "projectName": "org.adempiere.base" | ||
| + | } | ||
| + | ``` | ||
| + | - Add `-DdebugPort=5005`, for e.g, `./mvnw --offline integration-test -DskipTests=false -Dtest=EnvTest -DdebugPort=5005` | ||
| + | - With the `-DdebugPort=5005` option, the test will start and "freeze" at 0% with a message like: | ||
| + | `Listening for transport dt_socket at address: 5005` | ||
| + | - At **Run and Debug**, start the **Attach by Process ID** configuration. A dialog will popup for you to select the process that's waiting for connection at port 5005. | ||
| + | - Some useful shortcuts: | ||
| + | - Ctrl+R : Open recent workspaces. | ||
| + | - Ctrl+P : Open recent files. | ||
| + | - Shift+Alt+B : Invoke Incremental or Full Build. | ||
| + | - Antigravity doesn't has build in support for generation of SerialVersionUID. Install the `Code Generator For Java` extension to get that. | ||
Latest revision as of 11:08, 17 April 2026
Setup
-
Install from https://antigravity.google/
-
Switch to visual studio code marketplace (Gear icon > Open Antigravity User Settings > Editor):
- https://marketplace.visualstudio.com/items (Marketplace Item URL)
- https://marketplace.visualstudio.com/_apis/public/gallery (Marketplace Gallery URL)
-
Install Extension Pack for Java extension
-
Install Eclipse PDE Support extension
-
File > Open Folder... , select iDempiere source folder
-
File > Add Folder to Workspace... , add idempiere-rest source folder to your workspace
-
File > Add Folder to Workspace... , add your other project source folder to your workspace
-
File > Save Workspace As... to save your workspace
- Add the following properties to "settings" in the save .code-workspace file to prevent unnecessary formatting only changes:
"settings": { "editor.formatOnSave": false, "editor.formatOnType": false, "editor.formatOnPaste": false, "editor.codeActionsOnSave": { "source.fixAll": "never", "source.organizeImports": "never" }, "java.configuration.updateBuildConfiguration": "disabled", "java.configuration.runtimes": [ { "name": "JavaSE-17", "path": "/usr/lib/jvm/java-17-temurin-jdk", "default": true } ], "java.project.resourceFilters": [], "files.eol": "\n", "files.trimTrailingWhitespace": false, "files.insertFinalNewline": false, "files.trimFinalNewlines": false }
- Replace
"path": "/usr/lib/jvm/java-17-temurin-jdk"with your JDK17 path. The default JVM configuration is important for test and remote debugging. "java.project.resourceFilters": []is to stop antigravity adding the following to .project files:<filteredResources> <filter> <id>1774448868880</id> <name></name> <type>30</type> <matcher> <id>org.eclipse.core.resources.regexFilterMatcher</id> <arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments> </matcher> </filter> </filteredResources>
- Add the following properties to "settings" in the save .code-workspace file to prevent unnecessary formatting only changes:
-
Add the following to {idempiere source folder}/.git/info/exclude file:
.project .vscode *.properties *.ks **/.settings/ *.sh **/*.launch *.blacklist *.blacklist.* *.code-workspace
-
To ignore changes to tracked .project files:
git update-index --skip-worktree **/.project
-
To restore tracking of .project files:
git update-index --no-skip-worktree **/.project
-
To set active target platform, right click on the target definition file (.target file) and select Reload Target Platform
Optional
- Install Eclipse Keymap extension to use Eclipse Key Binding
- Enable browser extension (Gear Icon > Open Antigravity User Settings > Enable Browser Tools)
- Install Gemini CLI: https://github.com/google-gemini/gemini-cli
- Enable Gemini CLI integration with antigravity: /ide install
- Note that this might be needed for /ide install:
sudo ln -s /usr/bin/antigravity /usr/local/bin/agy
- Note that this might be needed for /ide install:
- Install iDempiere examples for Gemini CLI
gemini skills install https://github.com/hengsin/idempiere-examples
- Install iDempiere skills for Gemini CLI: https://github.com/hengsin/idempiere-skills
- Add more source folder to your workspace (File > Add Folder to Workspace...)
What you still need from Eclipse
- Create new launch configuration
- Check and fix target platform state
Tips
- There's no build in tool to create OSGi component XML file from annotation but you can ask the agent to do that for you.
- To run a launch configuration, right click on launch configuration (.launch file) and select Debug PDE Application
- A new launch configuration entry will be added to the launch.json file.
- If the startup workspace folder is wrong, add the "cwd" property in launch.json to fix that (for e.g, "cwd": "/home/hengsin/idempiere-workspace/idempiere").
- If it is not launch with the intended Java runtime environment, add "javaExec" property in launch.json to set the Java runtime environment to use. This property should contain the absolute path of the Java executable to use (for e.g, "javaExec": "/usr/lib/jvm/java-17-temurin-jdk/bin/java").
- After the initial launch, open the Run/Debug View and launch from the drop down list of available launch configuration.
- Note that if you use Right Click > Debug PDE Application to launch a launch configuration again, it will overwrite the changes that you have make to the launch.json file.
- If there are changes to a .launch file, remove the entry from launch.json to recreate it from the latest .launch file.
- Add
"projectName": "org.adempiere.base"to enable evaluation of expression in debug (using the Debug Console). - You can use inline comment as instruction to guide the agent to generate code for your need. You can remove the inline comment after you have accept or reject the generated code.
- Automatic build can cause conflict with mvn build. You might want to disable automatic build if you frequently use maven to run build or run unit test.
- Add Customizations rule to guide the agent on the running of mvn build and unit test for iDempiere:
**For running of unit test and integration test using maven** * Run from workspace root folder * Set JAVA_HOME to /usr/lib/jvm/java-17-temurin-jdk * mvn integration-test -DskipTests=false -DmaterializeProduct=none -DassembleRepository=none -Dtest=**test class name** * Always run in terminal
- After making changes to MANIFEST.MF, run Full Build to resolve build errors.
- If you have an IDE or workspace settings that you can't locate the place to change it, try ask the agent to do it for you.
- To debug integration test
- Add the following to
"configurations"in launch.json:{ "type": "java", "request": "attach", "name": "Attach by Process ID", "processId": "${command:PickJavaProcess}", "projectName": "org.adempiere.base" }
- Add
-DdebugPort=5005, for e.g,./mvnw --offline integration-test -DskipTests=false -Dtest=EnvTest -DdebugPort=5005 - With the
-DdebugPort=5005option, the test will start and "freeze" at 0% with a message like:Listening for transport dt_socket at address: 5005 - At Run and Debug, start the Attach by Process ID configuration. A dialog will popup for you to select the process that's waiting for connection at port 5005.
- Add the following to
- Some useful shortcuts:
- Ctrl+R : Open recent workspaces.
- Ctrl+P : Open recent files.
- Shift+Alt+B : Invoke Incremental or Full Build.
- Antigravity doesn't has build in support for generation of SerialVersionUID. Install the
Code Generator For Javaextension to get that.
