Files
reflection-config-tool/README.md
T
2026-04-24 07:59:08 +02:00

2.0 KiB

Reflection Config Generator

Ein kleines CLI-Tool, das Java-Quellcode scannt und daraus eine reflection-config.json fuer Quarkus/GraalVM erzeugt.

Voraussetzungen

  • PowerShell 5.1+ oder PowerShell 7+
  • Optional: Python 3.9+ (wenn du die Python-Variante nutzen willst)

Nutzung

PowerShell (empfohlen)

powershell -ExecutionPolicy Bypass -File .\reflection_config_generator.ps1 `
  -SourceRoot C:\apps\service-a\src\main\java `
  -Package com.example `
  -Output C:\apps\service-a\src\main\resources\META-INF\native-image\reflection-config.json

Erzeugt standardmaessig reflection-config.json im aktuellen Verzeichnis, wenn -Output nicht gesetzt ist.

Mehrere Source-Roots und Packages

powershell -ExecutionPolicy Bypass -File .\reflection_config_generator.ps1 `
  -SourceRoot C:\apps\service-a\src\main\java, C:\apps\service-b\src\main\java `
  -Package com.company.project, org.shared.*

Ausgabe auf stdout

powershell -ExecutionPolicy Bypass -File .\reflection_config_generator.ps1 `
  -SourceRoot C:\apps\service-a\src\main\java `
  -Package com.example `
  -Stdout

Wichtige Optionen

  • -SourceRoot: Quellverzeichnis, rekursiv gescannt (mehrfach/als Liste nutzbar)
  • -Package: Package-Praefix(e), z. B. com.acme oder com.acme.*
  • -Output: Zielpfad (Standard: reflection-config.json)
  • -Stdout: JSON statt Datei direkt in die Konsole
  • -IncludeDeclared:$true/$false: Declared-Member-Flags (Standard: true)
  • -IncludePublic:$true/$false: Public-Member-Flags (Standard: false)
  • -IncludeConstructors:$true/$false
  • -IncludeMethods:$true/$false
  • -IncludeFields:$true/$false
  • -NoSort: Discovery-Reihenfolge behalten

Python-Variante (optional)

python reflection_config_generator.py --package com.example

Hinweise

  • Das Tool liest .java-Dateien (nicht .class-Dateien).
  • Es werden Top-Level-Typen (class, interface, enum, record) erfasst.
  • Dateien ohne package-Deklaration werden ignoriert.