feature/ZED IDE Setup for OBP-API Development

This commit is contained in:
Marko Milić 2025-09-02 09:30:53 +02:00
parent f0bb6f2a2c
commit 2448283108
9 changed files with 903 additions and 143 deletions

3
.gitignore vendored
View File

@ -31,8 +31,9 @@ obp-api/src/main/scala/code/api/v3_0_0/custom/
marketing_diagram_generation/outputs/*
.bloop
!.bloop/*.json
.bsp
.specstory
project/project
coursier
*.code-workspace
*.code-workspace

76
.metals-config.json Normal file
View File

@ -0,0 +1,76 @@
{
"maven": {
"enabled": true
},
"metals": {
"serverVersion": "1.0.0",
"javaHome": "/usr/lib/jvm/java-17-openjdk-amd64",
"bloopVersion": "2.0.0",
"superMethodLensesEnabled": true,
"enableSemanticHighlighting": true,
"compileOnSave": true,
"testUserInterface": "Code Lenses",
"inlayHints": {
"enabled": true,
"hintsInPatternMatch": {
"enabled": true
},
"implicitArguments": {
"enabled": true
},
"implicitConversions": {
"enabled": true
},
"inferredTypes": {
"enabled": true
},
"typeParameters": {
"enabled": true
}
}
},
"buildTargets": [
{
"id": "obp-commons",
"displayName": "obp-commons",
"baseDirectory": "file:///home/marko/Tesobe/GitHub/constantine2nd/OBP-API/obp-commons/",
"tags": ["library"],
"languageIds": ["scala", "java"],
"dependencies": [],
"capabilities": {
"canCompile": true,
"canTest": true,
"canRun": false,
"canDebug": true
},
"dataKind": "scala",
"data": {
"scalaOrganization": "org.scala-lang",
"scalaVersion": "2.12.20",
"scalaBinaryVersion": "2.12",
"platform": "jvm"
}
},
{
"id": "obp-api",
"displayName": "obp-api",
"baseDirectory": "file:///home/marko/Tesobe/GitHub/constantine2nd/OBP-API/obp-api/",
"tags": ["application"],
"languageIds": ["scala", "java"],
"dependencies": ["obp-commons"],
"capabilities": {
"canCompile": true,
"canTest": true,
"canRun": true,
"canDebug": true
},
"dataKind": "scala",
"data": {
"scalaOrganization": "org.scala-lang",
"scalaVersion": "2.12.20",
"scalaBinaryVersion": "2.12",
"platform": "jvm"
}
}
]
}

View File

@ -46,11 +46,22 @@ This project is dual licensed under the AGPL V3 (see NOTICE) and commercial lice
The project uses Maven 3 as its build tool.
To compile and run Jetty, install Maven 3, create your configuration in `obp-api/src/main/resources/props/default.props` and execute:
To compile and run Jetty, install Maven 3, create your configuration in `obp-api/src/main/resources/props/`, copy `sample.props.template` to `default.props` and edit the latter. Then:
```sh
mvn install -pl .,obp-commons && mvn jetty:run -pl obp-api
```
### ZED IDE Setup
For ZED IDE users, we provide a complete development environment with Scala language server support:
```bash
./zed/setup-zed-ide.sh
```
This sets up automated build tasks, code navigation, and real-time error checking. See [`zed/README.md`](zed/README.md) for complete documentation.
In case the above command fails try the next one:
```sh
@ -207,6 +218,7 @@ Once Postgres is installed (On macOS, use `brew`):
1. Grant all on database `obpdb` to `obp`; (So OBP-API can create tables etc.)
#### For newer versions of postgres 16 and above, you need to follow the following instructions
-- Connect to the sandbox database
\c sandbox;

76
zed/.metals-config.json Normal file
View File

@ -0,0 +1,76 @@
{
"maven": {
"enabled": true
},
"metals": {
"serverVersion": "1.0.0",
"javaHome": "/usr/lib/jvm/java-17-openjdk-amd64",
"bloopVersion": "2.0.0",
"superMethodLensesEnabled": true,
"enableSemanticHighlighting": true,
"compileOnSave": true,
"testUserInterface": "Code Lenses",
"inlayHints": {
"enabled": true,
"hintsInPatternMatch": {
"enabled": true
},
"implicitArguments": {
"enabled": true
},
"implicitConversions": {
"enabled": true
},
"inferredTypes": {
"enabled": true
},
"typeParameters": {
"enabled": true
}
}
},
"buildTargets": [
{
"id": "obp-commons",
"displayName": "obp-commons",
"baseDirectory": "file:///home/marko/Tesobe/GitHub/constantine2nd/OBP-API/obp-commons/",
"tags": ["library"],
"languageIds": ["scala", "java"],
"dependencies": [],
"capabilities": {
"canCompile": true,
"canTest": true,
"canRun": false,
"canDebug": true
},
"dataKind": "scala",
"data": {
"scalaOrganization": "org.scala-lang",
"scalaVersion": "2.12.20",
"scalaBinaryVersion": "2.12",
"platform": "jvm"
}
},
{
"id": "obp-api",
"displayName": "obp-api",
"baseDirectory": "file:///home/marko/Tesobe/GitHub/constantine2nd/OBP-API/obp-api/",
"tags": ["application"],
"languageIds": ["scala", "java"],
"dependencies": ["obp-commons"],
"capabilities": {
"canCompile": true,
"canTest": true,
"canRun": true,
"canDebug": true
},
"dataKind": "scala",
"data": {
"scalaOrganization": "org.scala-lang",
"scalaVersion": "2.12.20",
"scalaBinaryVersion": "2.12",
"platform": "jvm"
}
}
]
}

View File

@ -1,133 +1,298 @@
# Zed IDE Configuration for OBP-API
# ZED IDE Setup for OBP-API Development
This folder contains the recommended Zed IDE configuration for the OBP-API project. Each developer can set up their own personalized Zed environment while maintaining consistent project settings.
> **Complete ZED IDE integration for the Open Bank Project API**
## Quick Setup
This folder contains everything needed to set up ZED IDE with full Scala language server support, automated build tasks, and streamlined development workflows for OBP-API.
Run the setup script to copy the configuration files to your local `.zed` folder:
## 🚀 Quick Setup (5 minutes)
### Prerequisites
- **Java 17+** (OpenJDK recommended)
- **Maven 3.6+**
- **ZED IDE** (latest version)
### Single Setup Script
**Linux/macOS:**
```bash
./zed/setup-zed.sh
cd OBP-API
./zed/setup-zed-ide.sh
```
**Windows:**
```cmd
zed\setup-zed.bat
This unified script automatically:
- ✅ Installs missing dependencies (Coursier, Bloop)
- ✅ Compiles the project and resolves dependencies
- ✅ Generates dynamic Bloop configurations
- ✅ Sets up Metals language server
- ✅ Copies ZED configuration files to `.zed/` folder
- ✅ Configures build and run tasks
- ✅ Sets up manual-only code formatting
## 📁 What's Included
```
zed/
├── README.md # This comprehensive guide
├── setup-zed-ide.sh # Single unified setup script
├── generate-bloop-config.sh # Dynamic Bloop config generator
├── settings.json # ZED IDE settings template
├── tasks.json # Pre-configured build/run tasks
├── .metals-config.json # Metals language server config
└── setup-zed.bat # Windows setup script
```
This will create a `.zed` folder in the project root with the recommended settings.
## ⌨️ Essential Keyboard Shortcuts
## What's Included
| Action | Linux | macOS/Windows | Purpose |
| -------------------- | -------------- | ------------- | ----------------------------- |
| **Command Palette** | `Ctrl+Shift+P` | `Cmd+Shift+P` | Access all tasks |
| **Go to Definition** | `F12` | `F12` | Navigate to symbol definition |
| **Find References** | `Shift+F12` | `Shift+F12` | Find all symbol usages |
| **Quick Open File** | `Ctrl+P` | `Cmd+P` | Fast file navigation |
| **Format Code** | `Ctrl+Shift+I` | `Cmd+Shift+I` | Auto-format Scala code |
| **Symbol Search** | `Ctrl+T` | `Cmd+T` | Search symbols project-wide |
### 📁 Configuration Files
## 🛠️ Available Development Tasks
- **`settings.json`** - IDE settings optimized for Scala/OBP-API development
- **`tasks.json`** - Predefined tasks for building, running, and testing the project
Access via Command Palette (`Ctrl+Shift+P` on Linux, `Cmd+Shift+P` on macOS/Windows) → `"task: spawn"` (Linux) or `"Tasks: Spawn"` (macOS/Windows):
### ⚙️ Key Settings
### Core Development Tasks
- **Format on save: DISABLED** - Preserves your code formatting choices
- **Scala LSP (Metals) configuration** - Optimized for Maven-based Scala projects
- **UI preferences** - Consistent theme, font sizes, and panel layout
- **Semantic highlighting** - Enhanced code readability
| Task | Purpose | Duration | When to Use |
| ---------------------------- | ------------------------ | --------- | ------------------------------------ |
| **Quick Build Dependencies** | Build only dependencies | 1-3 min | First step, after dependency changes |
| **[1] Run OBP-API Server** | Start development server | 3-5 min | Daily development |
| **🔨 Build OBP-API** | Full project build | 2-5 min | After code changes |
| **Run Tests** | Execute test suite | 5-15 min | Before commits |
| **[3] Compile Only** | Quick syntax check | 30s-1 min | During development |
## Available Tasks
### Utility Tasks
Access tasks in Zed with `Cmd/Ctrl + Shift + P` → "task: spawn"
| Task | Purpose |
| --------------------------------- | ------------------------- |
| **[4] Clean Target Folders** | Remove build artifacts |
| **🔄 Continuous Compile (Scala)** | Auto-recompile on changes |
| **[2] Test API Root Endpoint** | Verify server status |
| **🔧 Kill Server on Port 8080** | Stop stuck processes |
| **🔍 Check Dependencies** | Verify Maven dependencies |
### 🚀 Development Tasks
## 🏗️ Development Workflow
| Task | Command | Description |
|------|---------|-------------|
| **[1] Run OBP-API Server** | `mvn jetty:run -pl obp-api` | Starts the OBP-API server on port 8080 |
| **[2] Test API Root Endpoint** | `curl http://localhost:8080/obp/v5.1.0/root` | Quick API health check |
| **[3] Compile Only** | `mvn compile -pl obp-api` | Compiles the project without running tests |
### Daily Development
### 🔨 Build Tasks
1. **Start Development Session**
- Linux: `Ctrl+Shift+P``"task: spawn"``"Quick Build Dependencies"`
- macOS: `Cmd+Shift+P``"Tasks: Spawn"``"Quick Build Dependencies"`
| Task | Command | Description |
|------|---------|-------------|
| **[4] Build OBP-API** | `mvn install -pl .,obp-commons -am -DskipTests` | Full build excluding tests |
| **[5] Clean Target Folders** | `mvn clean` | Removes all compiled artifacts |
2. **Start API Server**
- Use task `"[1] Run OBP-API Server"`
- Server runs on: `http://localhost:8080`
- Test endpoint: `http://localhost:8080/obp/v5.1.0/root`
### 🧪 Testing & Validation
3. **Code Development**
- Edit Scala files in `obp-api/src/main/scala/`
- Use `F12` for Go to Definition
- Auto-completion with `Ctrl+Space`
- Real-time error highlighting
- Format code with `Ctrl+Shift+I`
| Task | Command | Description |
|------|---------|-------------|
| **[7] Run Tests** | `mvn test -pl obp-api` | Executes the project test suite |
| **[8] Maven Validate** | `mvn validate` | Validates project structure and dependencies |
| **[9] Check Dependencies** | `mvn dependency:resolve` | Downloads and verifies all dependencies |
4. **Testing & Validation**
- Quick compile: `"[3] Compile Only"` task
- Run tests: `"Run Tests"` task
- API testing: `"[2] Test API Root Endpoint"` task
### 🛠️ Utility Tasks
## 🔧 Configuration Details
| Task | Command | Description |
|------|---------|-------------|
| **[6] Kill OBP-API Server** | `lsof -ti:8080 \| xargs kill -9` | Terminates any process running on port 8080 |
### ZED IDE Settings (`settings.json`)
## Typical Development Workflow
- **Format on Save**: DISABLED (manual formatting only - use `Ctrl+Shift+I`)
- **Scala LSP**: Optimized Metals configuration
- **Maven Integration**: Proper MAVEN_OPTS for Java 17+
- **UI Preferences**: One Dark theme, consistent layout
- **Inlay Hints**: Enabled for better code understanding
1. **Initial Setup**: `[4] Build OBP-API` - Build the project
2. **Development**: `[3] Compile Only` - Quick compilation during development
3. **Testing**: `[1] Run OBP-API Server``[2] Test API Root Endpoint`
4. **Cleanup**: `[6] Kill OBP-API Server` when done
### Build Tasks (`tasks.json`)
## Maven Configuration
All tasks include proper environment variables:
All Maven tasks use optimized JVM settings:
```
```bash
MAVEN_OPTS="-Xss128m --add-opens=java.base/java.util.jar=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED"
```
These settings resolve Java module system compatibility issues with newer JDK versions.
### Metals LSP (`.metals-config.json`)
## Customization
- **Build Tool**: Maven
- **Bloop Integration**: Dynamic configuration generation
- **Scala Version**: 2.12.20
- **Java Target**: Java 11 (compatible with Java 17)
The `.zed` folder is in `.gitignore`, so you can:
## 🚨 Troubleshooting
- Modify settings without affecting other developers
- Add personal tasks or shortcuts
- Adjust themes, fonts, and UI preferences
- Configure additional language servers
### Common Issues
### Example Customizations
| Problem | Symptom | Solution |
| ------------------------------- | ------------------------------------ | ------------------------------------------------ |
| **Language Server Not Working** | No go-to-definition, no autocomplete | Restart ZED, wait for Metals initialization |
| **Compilation Errors** | Red squiggly lines, build failures | Check Problems panel, run "Clean Target Folders" |
| **Server Won't Start** | Port 8080 busy | Run "Kill Server on Port 8080" task |
| **Out of Memory** | Build fails with heap space error | Already configured in tasks |
| **Missing Dependencies** | Import errors | Run "Check Dependencies" task |
**Add a custom task** (in `.zed/tasks.json`):
```json
{
"label": "My Custom Task",
"command": "echo",
"args": ["Hello World"],
"use_new_terminal": false
}
### Recovery Procedures
1. **Full Reset**:
```bash
./zed/setup-zed-ide.sh # Re-run complete setup
```
2. **Regenerate Bloop Configurations**:
```bash
./zed/generate-bloop-config.sh # Regenerate configs
```
3. **Clean Restart**:
- Clean build with "Clean Target Folders" task
- Restart ZED IDE
- Wait for Metals to reinitialize (2-3 minutes)
### Platform-Specific Notes
#### Linux Users
- Use `"task: spawn"` in command palette (not `"Tasks: Spawn"`)
- Ensure proper Java permissions for Maven
#### macOS/Windows Users
- Use `"Tasks: Spawn"` in command palette
- Windows users can also use `setup-zed.bat`
## 🌐 API Development
### Project Structure
```
OBP-API/
├── obp-api/ # Main API application
│ └── src/main/scala/ # Scala source code
│ └── code/api/ # API endpoint definitions
│ ├── v5_1_0/ # Latest API version
│ ├── v4_0_0/ # Previous versions
│ └── util/ # Utility functions
├── obp-commons/ # Shared utilities and models
│ └── src/main/scala/ # Common Scala code
└── .zed/ # ZED IDE configuration (generated)
```
**Change theme** (in `.zed/settings.json`):
```json
{
"theme": "Ayu Dark"
}
```
### Adding New API Endpoints
## Troubleshooting
1. Navigate to `obp-api/src/main/scala/code/api/v5_1_0/`
2. Find appropriate API trait (e.g., `OBPAPI5_1_0.scala`)
3. Follow existing endpoint patterns
4. Use `F12` to navigate to helper functions
5. Test with API test task
### Testing Endpoints
### Port 8080 Already in Use
```bash
# Use task [6] or run manually:
lsof -ti:8080 | xargs kill -9
# Root API information
curl http://localhost:8080/obp/v5.1.0/root
# Health check
curl http://localhost:8080/obp/v5.1.0/config
# Banks list (requires proper setup)
curl http://localhost:8080/obp/v5.1.0/banks
```
### Metals LSP Issues
1. Restart Zed IDE
2. Run `[8] Maven Validate` to ensure project structure is correct
3. Check that Java 11+ is installed and configured
## 🎯 Pro Tips
### Build Failures
1. Run `[5] Clean Target Folders`
2. Run `[9] Check Dependencies`
3. Run `[4] Build OBP-API`
### Code Navigation
## Support
- **Quick file access**: `Ctrl+P` then type filename
- **Symbol search**: `Ctrl+T` then type function/class name
- **Project-wide text search**: `Ctrl+Shift+F`
For Zed IDE-specific issues, consult the [Zed documentation](https://zed.dev/docs).
For OBP-API project issues, refer to the main project README.
### Efficiency Shortcuts
- `Ctrl+/` - Toggle line comment
- `Ctrl+D` - Select next occurrence
- `Ctrl+Shift+L` - Select all occurrences
- `F2` - Rename symbol
- `Alt+←/→` - Navigate back/forward
### Performance Optimization
- Close unused files to reduce memory usage
- Use "Continuous Compile" for faster feedback
- Limit test runs to specific modules during development
## 📚 Additional Resources
### Documentation
- **OBP-API Project**: https://github.com/OpenBankProject/OBP-API
- **API Documentation**: https://apiexplorer.openbankproject.com
- **Community Forums**: https://openbankproject.com
### Learning Resources
- **Scala**: https://docs.scala-lang.org/
- **Lift Framework**: https://liftweb.net/
- **Maven**: https://maven.apache.org/guides/
- **ZED IDE**: https://zed.dev/docs
## 🆘 Getting Help
### Diagnostic Commands
```bash
# Check Java version
java -version
# Check Maven
mvn -version
# Check Bloop status
bloop projects
# Test compilation
bloop compile obp-commons obp-api
# Check ZED configuration
ls -la .zed/
```
### Common Error Messages
| Error | Cause | Solution |
| --------------------------- | ----------------------------- | ----------------------------- |
| "Java module system" errors | Java 17+ module restrictions | Already handled in MAVEN_OPTS |
| "Port 8080 already in use" | Previous server still running | Use "Kill Server" task |
| "Metals not responding" | Language server crashed | Restart ZED IDE |
| "Compilation failed" | Dependency issues | Run "Check Dependencies" |
---
## 🎉 Getting Started Checklist
- [ ] Install Java 17+, Maven 3.6+, ZED IDE
- [ ] Clone OBP-API repository
- [ ] Run `./zed/setup-zed-ide.sh` (single setup script)
- [ ] Open project in ZED IDE
- [ ] Wait for Metals initialization (2-3 minutes)
- [ ] Run "Quick Build Dependencies" task
- [ ] Start server with "[1] Run OBP-API Server" task
- [ ] Test API at http://localhost:8080/obp/v5.1.0/root
- [ ] Try "Go to Definition" (F12) on Scala symbol
- [ ] Format code manually with `Ctrl+Shift+I` (auto-format disabled)
- [ ] Make a small code change and test compilation
**Welcome to productive OBP-API development with ZED IDE! 🚀**
---
_This setup provides a complete, optimized development environment for the Open Bank Project API using ZED IDE with full Scala language server support._

263
zed/generate-bloop-config.sh Executable file
View File

@ -0,0 +1,263 @@
#!/bin/bash
# Generate portable Bloop configuration files for OBP-API
# This script creates Bloop JSON configurations with proper paths for any system
set -e
echo "🔧 Generating Bloop configuration files..."
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Get the project root directory (parent of zed folder)
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
echo "📁 Project root: $PROJECT_ROOT"
# Check if we're in the zed directory and project structure exists
if [[ ! -f "$PROJECT_ROOT/pom.xml" ]] || [[ ! -d "$PROJECT_ROOT/obp-api" ]] || [[ ! -d "$PROJECT_ROOT/obp-commons" ]]; then
echo -e "${RED}❌ Error: Could not find OBP-API project structure${NC}"
echo "Make sure you're running this from the zed/ folder of the OBP-API project"
exit 1
fi
# Change to project root for Maven operations
cd "$PROJECT_ROOT"
# Detect Java home
if [[ -z "$JAVA_HOME" ]]; then
JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java))))
echo -e "${YELLOW}⚠️ JAVA_HOME not set, detected: $JAVA_HOME${NC}"
else
echo -e "${GREEN}✅ JAVA_HOME: $JAVA_HOME${NC}"
fi
# Get Maven local repository
M2_REPO=$(mvn help:evaluate -Dexpression=settings.localRepository -q -DforceStdout 2>/dev/null || echo "$HOME/.m2/repository")
echo "📦 Maven repository: $M2_REPO"
# Ensure .bloop directory exists in project root
mkdir -p "$PROJECT_ROOT/.bloop"
# Generate obp-commons.json
echo "🔨 Generating obp-commons configuration..."
cat > "$PROJECT_ROOT/.bloop/obp-commons.json" << EOF
{
"version": "1.5.5",
"project": {
"name": "obp-commons",
"directory": "${PROJECT_ROOT}/obp-commons",
"workspaceDir": "${PROJECT_ROOT}",
"sources": [
"${PROJECT_ROOT}/obp-commons/src/main/scala",
"${PROJECT_ROOT}/obp-commons/src/main/java"
],
"dependencies": [],
"classpath": [
"${PROJECT_ROOT}/obp-commons/target/classes",
"${M2_REPO}/net/liftweb/lift-common_2.12/3.5.0/lift-common_2.12-3.5.0.jar",
"${M2_REPO}/org/scala-lang/scala-library/2.12.12/scala-library-2.12.12.jar",
"${M2_REPO}/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar",
"${M2_REPO}/org/scala-lang/modules/scala-xml_2.12/1.3.0/scala-xml_2.12-1.3.0.jar",
"${M2_REPO}/org/scala-lang/modules/scala-parser-combinators_2.12/1.1.2/scala-parser-combinators_2.12-1.1.2.jar",
"${M2_REPO}/net/liftweb/lift-util_2.12/3.5.0/lift-util_2.12-3.5.0.jar",
"${M2_REPO}/org/scala-lang/scala-compiler/2.12.12/scala-compiler-2.12.12.jar",
"${M2_REPO}/net/liftweb/lift-actor_2.12/3.5.0/lift-actor_2.12-3.5.0.jar",
"${M2_REPO}/net/liftweb/lift-markdown_2.12/3.5.0/lift-markdown_2.12-3.5.0.jar",
"${M2_REPO}/joda-time/joda-time/2.10/joda-time-2.10.jar",
"${M2_REPO}/org/joda/joda-convert/2.1/joda-convert-2.1.jar",
"${M2_REPO}/commons-codec/commons-codec/1.11/commons-codec-1.11.jar",
"${M2_REPO}/nu/validator/htmlparser/1.4.12/htmlparser-1.4.12.jar",
"${M2_REPO}/xerces/xercesImpl/2.11.0/xercesImpl-2.11.0.jar",
"${M2_REPO}/xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.jar",
"${M2_REPO}/org/mindrot/jbcrypt/0.4/jbcrypt-0.4.jar",
"${M2_REPO}/net/liftweb/lift-mapper_2.12/3.5.0/lift-mapper_2.12-3.5.0.jar",
"${M2_REPO}/net/liftweb/lift-db_2.12/3.5.0/lift-db_2.12-3.5.0.jar",
"${M2_REPO}/net/liftweb/lift-webkit_2.12/3.5.0/lift-webkit_2.12-3.5.0.jar",
"${M2_REPO}/commons-fileupload/commons-fileupload/1.3.3/commons-fileupload-1.3.3.jar",
"${M2_REPO}/commons-io/commons-io/2.2/commons-io-2.2.jar",
"${M2_REPO}/org/mozilla/rhino/1.7.10/rhino-1.7.10.jar",
"${M2_REPO}/net/liftweb/lift-proto_2.12/3.5.0/lift-proto_2.12-3.5.0.jar",
"${M2_REPO}/org/scala-lang/scala-reflect/2.12.20/scala-reflect-2.12.20.jar",
"${M2_REPO}/org/scalatest/scalatest_2.12/3.0.8/scalatest_2.12-3.0.8.jar",
"${M2_REPO}/org/scalactic/scalactic_2.12/3.0.8/scalactic_2.12-3.0.8.jar",
"${M2_REPO}/net/liftweb/lift-json_2.12/3.5.0/lift-json_2.12-3.5.0.jar",
"${M2_REPO}/org/scala-lang/scalap/2.12.12/scalap-2.12.12.jar",
"${M2_REPO}/com/thoughtworks/paranamer/paranamer/2.8/paranamer-2.8.jar",
"${M2_REPO}/com/alibaba/transmittable-thread-local/2.11.5/transmittable-thread-local-2.11.5.jar",
"${M2_REPO}/org/apache/commons/commons-lang3/3.12.0/commons-lang3-3.12.0.jar",
"${M2_REPO}/org/apache/commons/commons-text/1.10.0/commons-text-1.10.0.jar",
"${M2_REPO}/com/google/guava/guava/32.0.0-jre/guava-32.0.0-jre.jar",
"${M2_REPO}/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar",
"${M2_REPO}/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar",
"${M2_REPO}/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar",
"${M2_REPO}/org/checkerframework/checker-qual/3.33.0/checker-qual-3.33.0.jar",
"${M2_REPO}/com/google/errorprone/error_prone_annotations/2.18.0/error_prone_annotations-2.18.0.jar",
"${M2_REPO}/com/google/j2objc/j2objc-annotations/2.8/j2objc-annotations-2.8.jar"
],
"out": "${PROJECT_ROOT}/obp-commons/target/classes",
"classesDir": "${PROJECT_ROOT}/obp-commons/target/classes",
"resources": [
"${PROJECT_ROOT}/obp-commons/src/main/resources"
],
"scala": {
"organization": "org.scala-lang",
"name": "scala-compiler",
"version": "2.12.20",
"options": [
"-unchecked",
"-explaintypes",
"-encoding",
"UTF-8",
"-feature"
],
"jars": [
"${M2_REPO}/org/scala-lang/scala-library/2.12.20/scala-library-2.12.20.jar",
"${M2_REPO}/org/scala-lang/scala-compiler/2.12.20/scala-compiler-2.12.20.jar",
"${M2_REPO}/org/scala-lang/scala-reflect/2.12.20/scala-reflect-2.12.20.jar"
],
"analysis": "${PROJECT_ROOT}/obp-commons/target/bloop-bsp-clients-classes/classes-Metals-",
"setup": {
"order": "mixed",
"addLibraryToBootClasspath": true,
"addCompilerToClasspath": false,
"addExtraJarsToClasspath": false,
"manageBootClasspath": true,
"filterLibraryFromClasspath": true
}
},
"java": {
"options": ["-source", "11", "-target", "11"]
},
"platform": {
"name": "jvm",
"config": {
"home": "${JAVA_HOME}",
"options": []
},
"mainClass": []
},
"resolution": {
"modules": []
},
"tags": ["library"]
}
}
EOF
# Generate obp-api.json
echo "🔨 Generating obp-api configuration..."
cat > "$PROJECT_ROOT/.bloop/obp-api.json" << EOF
{
"version": "1.5.5",
"project": {
"name": "obp-api",
"directory": "${PROJECT_ROOT}/obp-api",
"workspaceDir": "${PROJECT_ROOT}",
"sources": [
"${PROJECT_ROOT}/obp-api/src/main/scala",
"${PROJECT_ROOT}/obp-api/src/main/java"
],
"dependencies": ["obp-commons"],
"classpath": [
"${PROJECT_ROOT}/obp-api/target/classes",
"${PROJECT_ROOT}/obp-commons/target/classes",
"${M2_REPO}/com/tesobe/obp-commons/1.10.1/obp-commons-1.10.1.jar",
"${M2_REPO}/net/liftweb/lift-common_2.12/3.5.0/lift-common_2.12-3.5.0.jar",
"${M2_REPO}/org/scala-lang/scala-library/2.12.12/scala-library-2.12.12.jar",
"${M2_REPO}/org/slf4j/slf4j-api/1.7.32/slf4j-api-1.7.32.jar",
"${M2_REPO}/org/scala-lang/modules/scala-xml_2.12/1.3.0/scala-xml_2.12-1.3.0.jar",
"${M2_REPO}/net/liftweb/lift-util_2.12/3.5.0/lift-util_2.12-3.5.0.jar",
"${M2_REPO}/org/scala-lang/scala-compiler/2.12.12/scala-compiler-2.12.12.jar",
"${M2_REPO}/net/liftweb/lift-mapper_2.12/3.5.0/lift-mapper_2.12-3.5.0.jar",
"${M2_REPO}/net/liftweb/lift-json_2.12/3.5.0/lift-json_2.12-3.5.0.jar",
"${M2_REPO}/org/scala-lang/scala-reflect/2.12.20/scala-reflect-2.12.20.jar",
"${M2_REPO}/net/databinder/dispatch/dispatch-lift-json_2.12/0.13.1/dispatch-lift-json_2.12-0.13.1.jar",
"${M2_REPO}/ch/qos/logback/logback-classic/1.2.13/logback-classic-1.2.13.jar",
"${M2_REPO}/org/slf4j/log4j-over-slf4j/1.7.26/log4j-over-slf4j-1.7.26.jar",
"${M2_REPO}/org/slf4j/slf4j-ext/1.7.26/slf4j-ext-1.7.26.jar",
"${M2_REPO}/org/bouncycastle/bcpg-jdk15on/1.70/bcpg-jdk15on-1.70.jar",
"${M2_REPO}/org/bouncycastle/bcpkix-jdk15on/1.70/bcpkix-jdk15on-1.70.jar",
"${M2_REPO}/org/apache/commons/commons-lang3/3.12.0/commons-lang3-3.12.0.jar",
"${M2_REPO}/org/apache/commons/commons-text/1.10.0/commons-text-1.10.0.jar",
"${M2_REPO}/com/github/everit-org/json-schema/org.everit.json.schema/1.6.1/org.everit.json.schema-1.6.1.jar"
],
"out": "${PROJECT_ROOT}/obp-api/target/classes",
"classesDir": "${PROJECT_ROOT}/obp-api/target/classes",
"resources": [
"${PROJECT_ROOT}/obp-api/src/main/resources"
],
"scala": {
"organization": "org.scala-lang",
"name": "scala-compiler",
"version": "2.12.20",
"options": [
"-unchecked",
"-explaintypes",
"-encoding",
"UTF-8",
"-feature"
],
"jars": [
"${M2_REPO}/org/scala-lang/scala-library/2.12.20/scala-library-2.12.20.jar",
"${M2_REPO}/org/scala-lang/scala-compiler/2.12.20/scala-compiler-2.12.20.jar",
"${M2_REPO}/org/scala-lang/scala-reflect/2.12.20/scala-reflect-2.12.20.jar"
],
"analysis": "${PROJECT_ROOT}/obp-api/target/bloop-bsp-clients-classes/classes-Metals-",
"setup": {
"order": "mixed",
"addLibraryToBootClasspath": true,
"addCompilerToClasspath": false,
"addExtraJarsToClasspath": false,
"manageBootClasspath": true,
"filterLibraryFromClasspath": true
}
},
"java": {
"options": ["-source", "11", "-target", "11"]
},
"platform": {
"name": "jvm",
"config": {
"home": "${JAVA_HOME}",
"options": []
},
"mainClass": []
},
"resolution": {
"modules": []
},
"tags": ["application"]
}
}
EOF
echo -e "${GREEN}✅ Generated $PROJECT_ROOT/.bloop/obp-commons.json${NC}"
echo -e "${GREEN}✅ Generated $PROJECT_ROOT/.bloop/obp-api.json${NC}"
# Verify the configurations
echo "🔍 Verifying generated configurations..."
if command -v bloop &> /dev/null; then
if bloop projects | grep -q "obp-api\|obp-commons"; then
echo -e "${GREEN}✅ Bloop can detect the projects${NC}"
else
echo -e "${YELLOW}⚠️ Bloop server may need to be restarted to detect new configurations${NC}"
echo "Run: pkill -f bloop && bloop server &"
fi
else
echo -e "${YELLOW}⚠️ Bloop not found, skipping verification${NC}"
fi
echo ""
echo -e "${GREEN}🎉 Bloop configuration generation complete!${NC}"
echo ""
echo "📋 Next steps:"
echo "1. Restart Bloop server if needed: pkill -f bloop && bloop server &"
echo "2. Verify projects are detected: bloop projects"
echo "3. Test compilation: bloop compile obp-commons obp-api"
echo "4. Open project in Zed IDE for full language server support"
echo ""
echo -e "${GREEN}Happy coding! 🚀${NC}"

View File

@ -61,8 +61,7 @@
"metals.sbtScript": "",
"metals.scalafmtConfigPath": ".scalafmt.conf",
"metals.enableSemanticHighlighting": true,
"metals.allowMultilineStringFormatting": false,
"metals.formattingProvider": "none",
"metals.allowMultilineStringFormatting": true,
"metals.inlayHints.enabled": true,
"metals.inlayHints.hintsInPatternMatch.enabled": true,
"metals.inlayHints.implicitArguments.enabled": true,

221
zed/setup-zed-ide.sh Executable file
View File

@ -0,0 +1,221 @@
#!/bin/bash
# ZED IDE Complete Setup Script for OBP-API
# This script provides a unified setup for ZED IDE with full Scala language server support
set -e
echo "🚀 Setting up ZED IDE for OBP-API Scala development..."
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Get the project root directory (parent of zed folder)
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
echo "📁 Project root: $PROJECT_ROOT"
# Check if we're in the zed directory and project structure exists
if [[ ! -f "$PROJECT_ROOT/pom.xml" ]] || [[ ! -d "$PROJECT_ROOT/obp-api" ]] || [[ ! -d "$PROJECT_ROOT/obp-commons" ]]; then
echo -e "${RED}❌ Error: Could not find OBP-API project structure${NC}"
echo "Make sure you're running this from the zed/ folder of the OBP-API project"
exit 1
fi
# Change to project root for Maven operations
cd "$PROJECT_ROOT"
echo "📁 Working directory: $(pwd)"
# Check prerequisites
echo "🔍 Checking prerequisites..."
# Check Java
if ! command -v java &> /dev/null; then
echo -e "${RED}❌ Java not found. Please install Java 11 or 17${NC}"
exit 1
fi
JAVA_VERSION=$(java -version 2>&1 | head -1 | cut -d'"' -f2 | cut -d'.' -f1-2)
echo -e "${GREEN}✅ Java found: ${JAVA_VERSION}${NC}"
# Check Maven
if ! command -v mvn &> /dev/null; then
echo -e "${RED}❌ Maven not found. Please install Maven${NC}"
exit 1
fi
MVN_VERSION=$(mvn -version 2>&1 | head -1 | cut -d' ' -f3)
echo -e "${GREEN}✅ Maven found: ${MVN_VERSION}${NC}"
# Check Coursier
if ! command -v cs &> /dev/null; then
echo -e "${YELLOW}⚠️ Coursier not found. Installing...${NC}"
curl -fL https://github.com/coursier/coursier/releases/latest/download/cs-x86_64-pc-linux.gz | gzip -d > cs
chmod +x cs
sudo mv cs /usr/local/bin/
echo -e "${GREEN}✅ Coursier installed${NC}"
else
echo -e "${GREEN}✅ Coursier found${NC}"
fi
# Check/Install Bloop
if ! command -v bloop &> /dev/null; then
echo -e "${YELLOW}⚠️ Bloop not found. Installing...${NC}"
cs install bloop
echo -e "${GREEN}✅ Bloop installed${NC}"
else
echo -e "${GREEN}✅ Bloop found: $(bloop about | head -1)${NC}"
fi
# Start Bloop server if not running
if ! pgrep -f "bloop.*server" > /dev/null; then
echo "🔧 Starting Bloop server..."
bloop server &
sleep 3
echo -e "${GREEN}✅ Bloop server started${NC}"
else
echo -e "${GREEN}✅ Bloop server already running${NC}"
fi
# Compile the project to ensure dependencies are resolved
echo "🔨 Compiling Maven project (this may take a few minutes)..."
if mvn compile -q; then
echo -e "${GREEN}✅ Maven compilation successful${NC}"
else
echo -e "${RED}❌ Maven compilation failed. Please fix compilation errors first.${NC}"
exit 1
fi
# Copy ZED configuration files to project root
echo "📋 Setting up ZED IDE configuration..."
ZED_DIR="$PROJECT_ROOT/.zed"
ZED_SRC_DIR="$PROJECT_ROOT/zed"
# Create .zed directory if it doesn't exist
if [ ! -d "$ZED_DIR" ]; then
echo "📁 Creating .zed directory..."
mkdir -p "$ZED_DIR"
else
echo "📁 .zed directory already exists"
fi
# Copy settings.json
if [ -f "$ZED_SRC_DIR/settings.json" ]; then
echo "⚙️ Copying settings.json..."
cp "$ZED_SRC_DIR/settings.json" "$ZED_DIR/settings.json"
echo -e "${GREEN}✅ settings.json copied successfully${NC}"
else
echo -e "${RED}❌ Error: settings.json not found in zed folder${NC}"
exit 1
fi
# Copy tasks.json
if [ -f "$ZED_SRC_DIR/tasks.json" ]; then
echo "📋 Copying tasks.json..."
cp "$ZED_SRC_DIR/tasks.json" "$ZED_DIR/tasks.json"
echo -e "${GREEN}✅ tasks.json copied successfully${NC}"
else
echo -e "${RED}❌ Error: tasks.json not found in zed folder${NC}"
exit 1
fi
# Copy .metals-config.json if it exists
if [[ -f "$ZED_SRC_DIR/.metals-config.json" ]]; then
echo "🔧 Copying Metals configuration..."
cp "$ZED_SRC_DIR/.metals-config.json" "$PROJECT_ROOT/.metals-config.json"
echo -e "${GREEN}✅ Metals configuration copied${NC}"
fi
echo -e "${GREEN}✅ ZED configuration files copied to .zed/ folder${NC}"
# Generate Bloop configuration files dynamically
echo "🔧 Generating Bloop configuration files..."
if [[ -f "$ZED_SRC_DIR/generate-bloop-config.sh" ]]; then
chmod +x "$ZED_SRC_DIR/generate-bloop-config.sh"
"$ZED_SRC_DIR/generate-bloop-config.sh"
echo -e "${GREEN}✅ Bloop configuration files generated${NC}"
else
# Fallback: Check if existing configurations are present
if [[ -f "$PROJECT_ROOT/.bloop/obp-commons.json" && -f "$PROJECT_ROOT/.bloop/obp-api.json" ]]; then
echo -e "${GREEN}✅ Bloop configuration files already exist${NC}"
else
echo -e "${RED}❌ Bloop configuration files missing and generator not found.${NC}"
echo "Please ensure .bloop/*.json files exist or run zed/generate-bloop-config.sh manually"
exit 1
fi
fi
# Restart Bloop server to pick up new configurations
echo "🔄 Restarting Bloop server to detect new configurations..."
pkill -f bloop 2>/dev/null || true
sleep 1
bloop server &
sleep 2
# Verify Bloop can see projects
echo "🔍 Verifying Bloop projects..."
BLOOP_PROJECTS=$(bloop projects 2>/dev/null || echo "")
if [[ "$BLOOP_PROJECTS" == *"obp-api"* && "$BLOOP_PROJECTS" == *"obp-commons"* ]]; then
echo -e "${GREEN}✅ Bloop projects detected:${NC}"
echo "$BLOOP_PROJECTS" | sed 's/^/ /'
else
echo -e "${YELLOW}⚠️ Bloop projects not immediately detected. This is normal for fresh setups.${NC}"
echo "The configuration should work when you open ZED IDE."
fi
# Test Bloop compilation
echo "🧪 Testing Bloop compilation..."
if bloop compile obp-commons > /dev/null 2>&1; then
echo -e "${GREEN}✅ Bloop compilation test successful${NC}"
else
echo -e "${YELLOW}⚠️ Bloop compilation test failed, but setup is complete. Try restarting ZED IDE.${NC}"
fi
# Check ZED configuration
if [[ -f "$PROJECT_ROOT/.zed/settings.json" ]]; then
echo -e "${GREEN}✅ ZED configuration found${NC}"
else
echo -e "${YELLOW}⚠️ ZED configuration not found in .zed/settings.json${NC}"
fi
echo ""
echo -e "${GREEN}🎉 ZED IDE setup completed successfully!${NC}"
echo ""
echo "Your ZED configuration includes:"
echo " • Format on save: DISABLED (manual formatting only - use Ctrl+Shift+I)"
echo " • Scala/Metals LSP configuration optimized for OBP-API"
echo " • Pre-configured build and run tasks"
echo " • Dynamic Bloop configuration for language server support"
echo ""
echo "📋 Next steps:"
echo "1. Open ZED IDE"
echo "2. Open the OBP-API project directory in ZED"
echo "3. Wait for Metals to initialize (may take a few minutes)"
echo "4. Try 'Go to Definition' on a Scala symbol (F12 or Cmd+Click)"
echo ""
echo "🛠️ Available tasks (access with Cmd/Ctrl + Shift + P → 'task: spawn'):"
echo " • [1] Run OBP-API Server - Start development server"
echo " • [2] Test API Root Endpoint - Quick health check"
echo " • [3] Compile Only - Fast syntax check"
echo " • [4] Clean Target Folders - Remove build artifacts"
echo " • Quick Build Dependencies - Build deps only (for onboarding)"
echo " • Run Tests - Execute full test suite"
echo ""
echo "💡 Troubleshooting:"
echo "• If 'Go to Definition' doesn't work immediately, restart ZED IDE"
echo "• Use 'ZED: Reload Window' from the command palette if needed"
echo "• Check zed/README.md for comprehensive documentation"
echo "• Run './zed/generate-bloop-config.sh' to regenerate configurations if needed"
echo ""
echo "🔗 Resources:"
echo "• Complete ZED setup guide: zed/README.md"
echo "• Bloop projects: bloop projects"
echo "• Bloop compilation: bloop compile obp-commons obp-api"
echo ""
echo "Note: The .zed folder is in .gitignore, so you can customize settings"
echo " without affecting other developers."
echo ""
echo -e "${GREEN}Happy coding! 🚀${NC}"

View File

@ -1,53 +0,0 @@
#!/bin/bash
# Zed IDE Setup Script for OBP-API
# This script copies the recommended Zed configuration to your local .zed folder
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
ZED_DIR="$PROJECT_ROOT/.zed"
echo "🔧 Setting up Zed IDE configuration for OBP-API..."
# Create .zed directory if it doesn't exist
if [ ! -d "$ZED_DIR" ]; then
echo "📁 Creating .zed directory..."
mkdir -p "$ZED_DIR"
else
echo "📁 .zed directory already exists"
fi
# Copy settings.json
if [ -f "$SCRIPT_DIR/settings.json" ]; then
echo "⚙️ Copying settings.json..."
cp "$SCRIPT_DIR/settings.json" "$ZED_DIR/settings.json"
echo "✅ settings.json copied successfully"
else
echo "❌ Error: settings.json not found in zed folder"
exit 1
fi
# Copy tasks.json
if [ -f "$SCRIPT_DIR/tasks.json" ]; then
echo "📋 Copying tasks.json..."
cp "$SCRIPT_DIR/tasks.json" "$ZED_DIR/tasks.json"
echo "✅ tasks.json copied successfully"
else
echo "❌ Error: tasks.json not found in zed folder"
exit 1
fi
echo ""
echo "🎉 Zed IDE setup completed successfully!"
echo ""
echo "Your Zed configuration includes:"
echo " • Format on save: DISABLED (preserves your code formatting)"
echo " • Scala/Metals LSP configuration optimized for OBP-API"
echo " • 9 predefined tasks for building, running, and testing"
echo ""
echo "To see available tasks in Zed, use: Cmd/Ctrl + Shift + P → 'task: spawn'"
echo ""
echo "Note: The .zed folder is in .gitignore, so you can customize settings"
echo " without affecting other developers."