|
| 1 | +--- |
| 2 | +title: Development |
| 3 | +icon: code |
| 4 | +--- |
| 5 | +## Development |
| 6 | + |
| 7 | +### Requirements |
| 8 | + |
| 9 | +- **Java**: 17 or higher |
| 10 | +- **Maven**: 3.6 or higher |
| 11 | +- **IDE**: IntelliJ IDEA, Eclipse, or VS Code (optional) |
| 12 | + |
| 13 | +### IDE Setup |
| 14 | + |
| 15 | +1. **Import Project**: |
| 16 | + - Import as Maven project |
| 17 | + - Set JDK to 17 or higher |
| 18 | + - Ensure Maven dependencies are resolved |
| 19 | + |
| 20 | +2. **Code Style** (optional): |
| 21 | + - Configure code formatter |
| 22 | + - Set up import organization |
| 23 | + - Configure line endings |
| 24 | + |
| 25 | +3. **Run Configuration**: |
| 26 | + - Create run configuration for `Main.java` |
| 27 | + - Set program arguments: `--path <jar-file> --html --verbose` |
| 28 | + - Configure working directory |
| 29 | + |
| 30 | +### Building |
| 31 | + |
| 32 | +```bash |
| 33 | +# Full build with tests |
| 34 | +mvn clean package |
| 35 | + |
| 36 | +# Skip tests for faster iteration |
| 37 | +mvn clean package -DskipTests |
| 38 | + |
| 39 | +# Verbose Maven output |
| 40 | +mvn clean package -X |
| 41 | + |
| 42 | +# Build only specific module |
| 43 | +mvn clean package -pl linter-core |
| 44 | + |
| 45 | +# Install to local Maven repository |
| 46 | +mvn clean install |
| 47 | +``` |
| 48 | + |
| 49 | +### Testing |
| 50 | + |
| 51 | +```bash |
| 52 | +# Run all tests |
| 53 | +mvn test |
| 54 | + |
| 55 | +# Run specific test class |
| 56 | +mvn test -Dtest=BpmnLoadingTest |
| 57 | + |
| 58 | +# Run specific test method |
| 59 | +mvn test -Dtest=BpmnLoadingTest#testLoadBpmn |
| 60 | + |
| 61 | +# Run tests with verbose output |
| 62 | +mvn test -X |
| 63 | + |
| 64 | +# Skip tests during build |
| 65 | +mvn clean package -DskipTests |
| 66 | + |
| 67 | +# Run tests with coverage (if configured) |
| 68 | +mvn test jacoco:report |
| 69 | +``` |
| 70 | + |
| 71 | +### Development Workflow |
| 72 | + |
| 73 | +```bash |
| 74 | +# 1. Make changes to source code |
| 75 | +vim linter-core/src/main/java/dev/dsf/linter/service/BpmnLintingService.java |
| 76 | + |
| 77 | +# 2. Build the project |
| 78 | +mvn clean package -DskipTests |
| 79 | + |
| 80 | +# 3. Test with a sample plugin |
| 81 | +java -jar linter-cli/target/linter-cli-1.0-SNAPSHOT.jar \ |
| 82 | + --path test-plugin.jar --html --verbose |
| 83 | + |
| 84 | +# 4. Check the generated report |
| 85 | +open /tmp/dsf-linter-report-test-plugin/dsf-linter-report/index.html |
| 86 | + |
| 87 | +# 5. Run unit tests |
| 88 | +mvn test |
| 89 | + |
| 90 | +# 6. Commit changes |
| 91 | +git add . |
| 92 | +git commit -m "Description of changes" |
| 93 | +``` |
| 94 | + |
| 95 | +### Debugging |
| 96 | + |
| 97 | +#### Remote Debugging |
| 98 | + |
| 99 | +```bash |
| 100 | +# Start the linter with debugger enabled |
| 101 | +java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 \ |
| 102 | + -jar linter-cli/target/linter-cli-1.0-SNAPSHOT.jar \ |
| 103 | + --path plugin.jar --html --verbose |
| 104 | + |
| 105 | +# Attach debugger from IDE to localhost:5005 |
| 106 | +``` |
| 107 | + |
| 108 | +#### Logging |
| 109 | + |
| 110 | +The linter uses Logback for logging. Configuration files: |
| 111 | + |
| 112 | +- `logback.xml`: Standard logging (INFO level) |
| 113 | +- `logback-verbose.xml`: Verbose logging (DEBUG level, activated with `--verbose`) |
| 114 | + |
| 115 | +Log levels: |
| 116 | +- **ERROR**: Fatal errors and exceptions |
| 117 | +- **WARN**: Warnings and non-fatal issues |
| 118 | +- **INFO**: General information and progress |
| 119 | +- **DEBUG**: Detailed debugging information (verbose mode only) |
| 120 | + |
| 121 | +#### Common Debugging Scenarios |
| 122 | + |
| 123 | +1. **Plugin Not Found**: |
| 124 | + - Enable verbose logging |
| 125 | + - Check ServiceLoader registration |
| 126 | + - Verify classpath |
| 127 | + |
| 128 | +2. **Resource Not Found**: |
| 129 | + - Check JAR structure |
| 130 | + - Verify resource paths |
| 131 | + - Enable verbose logging |
| 132 | + |
| 133 | +3. **Class Loading Issues**: |
| 134 | + - Check classloader setup |
| 135 | + - Verify dependencies |
| 136 | + - Check API version compatibility |
| 137 | + |
| 138 | +### Code Style Guidelines |
| 139 | + |
| 140 | +- Follow Java naming conventions |
| 141 | +- Use meaningful variable and method names |
| 142 | +- Add JavaDoc comments for public APIs |
| 143 | +- Keep methods focused and small |
| 144 | +- Use immutable objects where possible |
| 145 | +- Handle exceptions appropriately |
| 146 | +- Write unit tests for new features |
0 commit comments