providedCompile
providedCompile ist eine Gradle-Dependency-Konfiguration für Libraries, die nicht ins WAR gepackt werden.
Der WildFly-Container liefert sie zur Laufzeit.
I. Beispiel
dependencies {
providedCompile 'jakarta.platform:jakarta.jakartaee-api:10.0.0'
}
II. Warum?
Wenn die Jakarta EE-API doppelt im Classpath wäre (im WAR und im Container), gibt es ClassCastException-Probleme. Daher: NUR zum Kompilieren benutzen.
III. Pendants
| Gradle | Bedeutung |
|---|---|
implementation |
Compile + Runtime + im WAR |
| providedCompile | Compile only, NICHT im WAR |
testImplementation |
Nur Tests |
.NET-Vergleich
Wie FrameworkReference in einer .csproj.