[ 
https://issues.apache.org/jira/browse/TOMEE-4706?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Richard Zowalla updated TOMEE-4706:
-----------------------------------
    Description: 
The Gradle plugin was built against Gradle 3.0 and did not work with current
Gradle.

h3. Gradle API artifact

{{org.gradle:gradle-core}} was never published past 6.1.1, so it cannot express
a modern Gradle API dependency from Maven. The module now uses
{{dev.gradleplugins:gradle-api}} 8.11.1, which is the Gradle API packaged as a
Maven artifact, equivalent to what {{gradleApi()}} gives a Gradle build.

h3. Removed and deprecated API

* {{Project.getBuildDir()}} is deprecated since Gradle 8 and removed in Gradle 
9.
  Replaced with {{project.getLayout().getBuildDirectory()}}.
* {{org.gradle.util.GFileUtils}} is no longer public API. The two call sites use
  {{java.nio.file.Files}} instead.
* {{fixConfig()}} called {{classpath.add(...)}} on the {{classpath}} field 
inside
  {{if (classpath == null)}}. It only avoided a NullPointerException when the
  argument expression threw {{UnknownConfigurationException}} first. It now
  assigns the configuration, which is what was meant.

h3. Task property validation

Gradle 9 fails the build on invalid task properties. Fixed:

* {{@Optional}} on 12 primitive properties. A primitive always has a value.
* {{@Input}} on {{File}} and {{List<File>}} properties ({{serverXml}},
  {{docBase}}, {{workDir}}, {{modules}}) and on {{classpath}}. This task starts 
a
  blocking server and never takes part in up-to-date checking, and the values 
are
  injected reflectively from the extension rather than through Gradle's property
  mechanism, so they are {{@Internal}}.
* Three fields were annotated but had no getter, so Gradle ignored the 
annotation
  and warned: {{singleClassloader}}, {{conf}} and 
{{classloaderFilteredPackages}}
  now have getters.

h3. Gradle 10 readiness

{{TomEEEmbeddedExtension.isSkipDefaultRepository()}} returned a boxed
{{Boolean}}, which is not a valid bean property with an {{is-}} prefix and is
deprecated for removal in Gradle 10. The field and setter were already 
primitive,
so the getter is now {{boolean}}. The caller's null check was always true for an
autoboxed primitive and is removed, so behaviour is unchanged.

h3. Verification

Built and run against Gradle 9.5.1 with a sample project: the plugin applies, 
the
extension configuration reaches the task, dependencies resolve, TomEE Embedded
boots, the deployed webapp answers HTTP 200, and "exit" shuts the server down
cleanly with the port released.

Note the task is interactive: it blocks reading stdin for "exit" or "quit", so
with stdin closed it starts and returns immediately. That behaviour is 
unchanged.

h3. Follow-up

One Gradle deprecation remains: the task calls {{getProject()}} from its
{{@TaskAction}}. That is incompatible with the configuration cache and will fail
in Gradle 10. Fixing it means capturing the project state the task needs
(configurations, project directory, build directory) at configuration time
instead, which is a larger refactor and is left for its own change.

  was:
The Gradle plugin was built against Gradle 3.0 and did not work with current
Gradle.

h3. Gradle API artifact

{{org.gradle:gradle\-core}} was never published past 6.1.1, so it cannot express
a modern Gradle API dependency from Maven. The module now uses
{{dev.gradleplugins:gradle\-api}} 8.11.1, which is the Gradle API packaged as a
Maven artifact, equivalent to what {{gradleApi\(\)}} gives a Gradle build.

h3. Removed and deprecated API* {{Project.getBuildDir\(\)}} is deprecated since 
Gradle 8 and removed in Gradle 9.
Replaced with {{project.getLayout\(\).getBuildDirectory\(\)}}.
* {{org.gradle.util.GFileUtils}} is no longer public API. The two call sites use
{{java.nio.file.Files}} instead.
* {{fixConfig\(\)}} called {{classpath.add\(...\)}} on the {{classpath}} field 
inside
{{if \(classpath == null\)}}. It only avoided a NullPointerException when the
argument expression threw {{UnknownConfigurationException}} first. It now
assigns the configuration, which is what was meant.

h3. Task property validation

Gradle 9 fails the build on invalid task properties. Fixed:

* {{@Optional}} on 12 primitive properties. A primitive always has a value.
* {{@Input}} on {{File}} and {{List}} properties \({{serverXml}},
{{docBase}}, {{workDir}}, {{modules}}\) and on {{classpath}}. This task starts a
blocking server and never takes part in up\-to\-date checking, and the values 
are
injected reflectively from the extension rather than through Gradle's property
mechanism, so they are {{@Internal}}.
* Three fields were annotated but had no getter, so Gradle ignored the 
annotation
and warned: {{singleClassloader}}, {{conf}} and {{classloaderFilteredPackages}}
now have getters.

h3. Gradle 10 readiness

{{TomEEEmbeddedExtension.isSkipDefaultRepository\(\)}} returned a boxed
{{Boolean}}, which is not a valid bean property with an {{is\-}} prefix and is
deprecated for removal in Gradle 10. The field and setter were already 
primitive,
so the getter is now {{boolean}}. The caller's null check was always true for an
autoboxed primitive and is removed, so behaviour is unchanged.

h3. Verification

Built and run against Gradle 9.5.1 with a sample project: the plugin applies, 
the
extension configuration reaches the task, dependencies resolve, TomEE Embedded
boots and the deployed webapp answers HTTP 200. No deprecation warnings remain
from the plugin.

Note the task is interactive: it blocks reading stdin for "exit" or "quit", so
with stdin closed it starts and returns immediately. That behaviour is 
unchanged.




> Migrate the Gradle plugin to a current Gradle version
> -----------------------------------------------------
>
>                 Key: TOMEE-4706
>                 URL: https://issues.apache.org/jira/browse/TOMEE-4706
>             Project: TomEE
>          Issue Type: Task
>            Reporter: Richard Zowalla
>            Priority: Major
>             Fix For: 11.0.0
>
>
> The Gradle plugin was built against Gradle 3.0 and did not work with current
> Gradle.
> h3. Gradle API artifact
> {{org.gradle:gradle-core}} was never published past 6.1.1, so it cannot 
> express
> a modern Gradle API dependency from Maven. The module now uses
> {{dev.gradleplugins:gradle-api}} 8.11.1, which is the Gradle API packaged as a
> Maven artifact, equivalent to what {{gradleApi()}} gives a Gradle build.
> h3. Removed and deprecated API
> * {{Project.getBuildDir()}} is deprecated since Gradle 8 and removed in 
> Gradle 9.
>   Replaced with {{project.getLayout().getBuildDirectory()}}.
> * {{org.gradle.util.GFileUtils}} is no longer public API. The two call sites 
> use
>   {{java.nio.file.Files}} instead.
> * {{fixConfig()}} called {{classpath.add(...)}} on the {{classpath}} field 
> inside
>   {{if (classpath == null)}}. It only avoided a NullPointerException when the
>   argument expression threw {{UnknownConfigurationException}} first. It now
>   assigns the configuration, which is what was meant.
> h3. Task property validation
> Gradle 9 fails the build on invalid task properties. Fixed:
> * {{@Optional}} on 12 primitive properties. A primitive always has a value.
> * {{@Input}} on {{File}} and {{List<File>}} properties ({{serverXml}},
>   {{docBase}}, {{workDir}}, {{modules}}) and on {{classpath}}. This task 
> starts a
>   blocking server and never takes part in up-to-date checking, and the values 
> are
>   injected reflectively from the extension rather than through Gradle's 
> property
>   mechanism, so they are {{@Internal}}.
> * Three fields were annotated but had no getter, so Gradle ignored the 
> annotation
>   and warned: {{singleClassloader}}, {{conf}} and 
> {{classloaderFilteredPackages}}
>   now have getters.
> h3. Gradle 10 readiness
> {{TomEEEmbeddedExtension.isSkipDefaultRepository()}} returned a boxed
> {{Boolean}}, which is not a valid bean property with an {{is-}} prefix and is
> deprecated for removal in Gradle 10. The field and setter were already 
> primitive,
> so the getter is now {{boolean}}. The caller's null check was always true for 
> an
> autoboxed primitive and is removed, so behaviour is unchanged.
> h3. Verification
> Built and run against Gradle 9.5.1 with a sample project: the plugin applies, 
> the
> extension configuration reaches the task, dependencies resolve, TomEE Embedded
> boots, the deployed webapp answers HTTP 200, and "exit" shuts the server down
> cleanly with the port released.
> Note the task is interactive: it blocks reading stdin for "exit" or "quit", so
> with stdin closed it starts and returns immediately. That behaviour is 
> unchanged.
> h3. Follow-up
> One Gradle deprecation remains: the task calls {{getProject()}} from its
> {{@TaskAction}}. That is incompatible with the configuration cache and will 
> fail
> in Gradle 10. Fixing it means capturing the project state the task needs
> (configurations, project directory, build directory) at configuration time
> instead, which is a larger refactor and is left for its own change.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to