Wrong classpath with Gradle `compileOnly` like instructions
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- java, spring-boot, vscode
- Bereich
- build-system, devtools
Rechercherichtung
Reproduziere das Projekt mit der gezeigten compileOnly-Abhängigkeit und vergleiche ./gradlew bootRun mit der Java-Startkonfiguration in .vscode/launch.json. Verfolge den für den VS Code-Start und die Testläufe zusammengestellten Klassenpfad; abgeschlossen bedeutet, dass compileOnly-Abhängigkeiten für die Kompilierung verfügbar bleiben, aber zur Laufzeit fehlen, entsprechend dem Verhalten von Gradle.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
We need to use the compileOnly in a gradle modules.
The expected behaviour is to have the dependency available at the compile time, but not at runtimes.
It's useful to create spring boot auto-configurations that load only if the dependency is present in the consumer module.
We have this declaration in a library:
dependencies {
compileOnly 'org.springframework.boot:spring-boot-starter-security'
}
In the application module we have this declaration:
dependencies {
implementation project(':libs:my-lib')
}
Running the following command, the project works as expected. The spring-boot-starter-security is not loaded.
./gradlew bootRun
But if we run the following configuration, the dependency is in classpath at runtime and the auto-configuration is applied at wrong.
{
"configurations": [
{
"type": "java",
"name": "Spring Boot-Application",
"request": "launch",
"cwd": "${workspaceFolder}",
"mainClass": "com.mycompany.Application",
"projectName": "application",
"args": ""
}
]
}
There is also dependency problems in test but I can't exactly explain what. There is some BeanDefinitionOverrideException that are not present running the ./gradlew test command.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 2.3k
- Forks
- 547
- Ø Merge
- 20 Std. 1 Min.
- Gemergte PRs (30 T.)
- 11
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus redhat-developer/vscode-java
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
redhat-developer/vscode-java#4426 ·
-
bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
redhat-developer/vscode-java#4506 · 3 Kommentare · 4 Reaktionen ·
-
bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
redhat-developer/vscode-java#4505 · 2 Kommentare · 1 Reaktion ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 52/100
redhat-developer/vscode-java#4504 · 3 Kommentare · 1 Reaktion ·
-
bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 62/100
redhat-developer/vscode-java#4502 ·
Alle Issues in redhat-developer/vscode-java
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
-
area:tools bug good first issue help wanted priority:P2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 90/100
TaewoooPark/Motifcode#14 ·
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
newrelic-experimental/preflight#793 · 1 Kommentar ·
-
bug 🐞
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
-
[Bounty proposal] fix(web): memory insights count an evening memory on the next day ($25 proposed) Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
BasedHardware/omi#15320 ·