You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the liberty gradle plugin is currently added to a new Spring Boot Application initialized by the Spring Initializr, the libertyDeploy task fails with the following error:
Caused by: java.lang.NullPointerException: Cannot invoke method getArchiveBaseName() on null object at io.openliberty.tools.gradle.tasks.DeployTask.installProjectArchive(DeployTask.groovy:128)
I had a look into the source code and came to the following conclusion: springBootTask initialized in the DeployTask.groovy by findSpringBootTask(project, springBootVersion) is initializes with null. Looking at the findSpringBootTask method in AbstractLibertyTask.groovy this can happen if the provided springBootVersion is null. Looking at the find findSpringBootVersion method defined in AbstractLibertyTask.groovy, which initializes the springBootVersion in DeployTask.groovy, the method relies on finding the dependency with name "spring-boot-gradle-plugin".
Analyzing project.buildscript.configurations.classpath.getAllDependencies() with the configuration generated by the Spring Initializr reveals that the name of the dependency is in fact org.springframework.boot.gradle.plugin:
To enable an error free task one has to replace the "org.springframework.boot" plugin defined in the plugins block with the plugin application apply plugin: "org.springframework.boot" as described on the org.springframework.boot plugin page.
As defining the plugin in the plugins block seems to be the more modern way of adding plugins to a gradle build, they at least call the plugin application legacy on the org.springframework.boot plugin page, and as the Spring Initializr sets up new Spring Boot projects with the org.springframework.boot plugin inside the plugins block, I would like to see the liberty plugin adding support for this. In addition there is documentation for the liberty plugin in the README to also be added inside of the plugins block, so the plugins block way seems to be supported by the liberty plugin too.
I would like to contribute by simply accepting org.springframework.boot.gradle.plugin as a valid name in addition to spring-boot-gradle-plugin. Let me know if this would be ok as a contribution.
The text was updated successfully, but these errors were encountered:
@PatrickWalter214 Thank you for reporting this and for your thorough investigation. We welcome contributions to improve our plugins. The contribution would just need a new or modified test that proves the fix works, and you would need to provide the CLA as described in the CONTRIBUTING doc.
When the liberty gradle plugin is currently added to a new Spring Boot Application initialized by the Spring Initializr, the libertyDeploy task fails with the following error:
Caused by: java.lang.NullPointerException: Cannot invoke method getArchiveBaseName() on null object at io.openliberty.tools.gradle.tasks.DeployTask.installProjectArchive(DeployTask.groovy:128)
I had a look into the source code and came to the following conclusion:
springBootTask
initialized in the DeployTask.groovy byfindSpringBootTask(project, springBootVersion)
is initializes with null. Looking at thefindSpringBootTask
method in AbstractLibertyTask.groovy this can happen if the providedspringBootVersion
is null. Looking at the findfindSpringBootVersion
method defined in AbstractLibertyTask.groovy, which initializes thespringBootVersion
in DeployTask.groovy, the method relies on finding the dependency with name "spring-boot-gradle-plugin".Analyzing
project.buildscript.configurations.classpath.getAllDependencies()
with the configuration generated by the Spring Initializr reveals that the name of the dependency is in factorg.springframework.boot.gradle.plugin
:DefaultExternalModuleDependency{group='org.springframework.boot', name='org.springframework.boot.gradle.plugin', version='3.3.1', configuration='default'}
To enable an error free task one has to replace the "org.springframework.boot" plugin defined in the plugins block with the plugin application
apply plugin: "org.springframework.boot"
as described on the org.springframework.boot plugin page.As defining the plugin in the plugins block seems to be the more modern way of adding plugins to a gradle build, they at least call the plugin application legacy on the org.springframework.boot plugin page, and as the Spring Initializr sets up new Spring Boot projects with the org.springframework.boot plugin inside the plugins block, I would like to see the liberty plugin adding support for this. In addition there is documentation for the liberty plugin in the README to also be added inside of the plugins block, so the plugins block way seems to be supported by the liberty plugin too.
I would like to contribute by simply accepting org.springframework.boot.gradle.plugin as a valid name in addition to spring-boot-gradle-plugin. Let me know if this would be ok as a contribution.
The text was updated successfully, but these errors were encountered: