Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

tomcatRun fails with Gradle 7.0 due to @Internal annotation on private getter #200

Closed
jshiell opened this issue Apr 26, 2021 · 11 comments
Closed
Assignees
Labels
Milestone

Comments

@jshiell
Copy link

jshiell commented Apr 26, 2021

When running tomcatRun with Gradle 7.0 you receive the following error:

A problem was found with the configuration of task ':tomcatRun' (type 'TomcatRun').
  - Type 'TomcatRun' property 'classesJarScanningRequired' is private and annotated with @Internal.

    Reason: Annotations on private getters are ignored.

    Possible solutions:
      1. Make the getter public.
      2. Annotate the public version of the getter.

    Please refer to https://docs.gradle.org/7.0/userguide/validation_problems.html#private_getter_must_not_be_annotated for more details about this problem.

I believe this should be easily resolved by removal @Internal from the getter in question, but I'm not familiar enough with the plugin API to make any predictions on what this would do to older versions.

Thanks very much for all of your work in this plugin!

@bmuschko
Copy link
Owner

Please send a pull request if you are interested in a fix. Thanks!

@patric-r
Copy link

There are multiple issues of the same kind when using Gradle 7.0, e.g. tomcatJasper task is affected as well:

* What went wrong:
A problem was found with the configuration of task ':tomcatJasper' (type 'TomcatJasper').
  - Type 'TomcatJasper' property 'jasperAttributes' is private and annotated with @Internal.
    
    Reason: Annotations on private getters are ignored.
    
    Possible solutions:
      1. Make the getter public.
      2. Annotate the public version of the getter.
    
    Please refer to https://docs.gradle.org/7.0/userguide/validation_problems.html#private_getter_must_not_be_annotated for more details about this problem.

@patric-r
Copy link

I tried to get this fixed, however, the unit tests fail after cloning the repo (without any local changes),
unfortunately without any additional info/stacktrace (even with providing --stacktrace)

What I'm doing wrong, @bmuschko ?

[...]
com.bmuschko.gradle.tomcat.TomcatJasperFunctionalTest > Runs Jasper compiler for Tomcat 6.0.x with default conventions FAILED
    org.gradle.testkit.runner.UnexpectedBuildFailure at TomcatJasperFunctionalTest.groovy:36

com.bmuschko.gradle.tomcat.TomcatJasperFunctionalTest > Runs Jasper compiler for Tomcat 7.0.x with default conventions FAILED
    org.gradle.testkit.runner.UnexpectedBuildFailure at TomcatJasperFunctionalTest.groovy:36

com.bmuschko.gradle.tomcat.TomcatJasperFunctionalTest > Runs Jasper compiler for Tomcat 8.0.x with default conventions FAILED
    org.gradle.testkit.runner.UnexpectedBuildFailure at TomcatJasperFunctionalTest.groovy:36

com.bmuschko.gradle.tomcat.TomcatJasperFunctionalTest > Runs Jasper compiler for Tomcat 8.5.x with default conventions FAILED
    org.gradle.testkit.runner.UnexpectedBuildFailure at TomcatJasperFunctionalTest.groovy:36

com.bmuschko.gradle.tomcat.TomcatJasperFunctionalTest > Runs Jasper compiler for Tomcat 9.0.x with default conventions FAILED
    org.gradle.testkit.runner.UnexpectedBuildFailure at TomcatJasperFunctionalTest.groovy:36

com.bmuschko.gradle.tomcat.TomcatJasperFunctionalTest > Can use Jasper compiler validation for Tomcat version 6.0.29 with attribute validateXml FAILED
    org.gradle.testkit.runner.UnexpectedBuildFailure at TomcatJasperFunctionalTest.groovy:64

com.bmuschko.gradle.tomcat.TomcatJasperFunctionalTest > Can use Jasper compiler validation for Tomcat version 6.0.39 with attribute validateTld FAILED
    org.gradle.testkit.runner.UnexpectedBuildFailure at TomcatJasperFunctionalTest.groovy:64

com.bmuschko.gradle.tomcat.TomcatJasperFunctionalTest > Can use Jasper compiler validation for Tomcat version 7.0.42 with attribute validateXml FAILED
    org.gradle.testkit.runner.UnexpectedBuildFailure at TomcatJasperFunctionalTest.groovy:64

com.bmuschko.gradle.tomcat.TomcatJasperFunctionalTest > Can use Jasper compiler validation for Tomcat version 7.0.50 with attribute validateTld FAILED
    org.gradle.testkit.runner.UnexpectedBuildFailure at TomcatJasperFunctionalTest.groovy:64

com.bmuschko.gradle.tomcat.TomcatJasperFunctionalTest > Can use Jasper compiler validation for Tomcat version 8.0.3 with attribute validateTld FAILED
    org.gradle.testkit.runner.UnexpectedBuildFailure at TomcatJasperFunctionalTest.groovy:64

com.bmuschko.gradle.tomcat.TomcatJasperFunctionalTest > Can use Jasper compiler validation for Tomcat version 9.0.1 with attribute validateXml FAILED
    org.gradle.testkit.runner.UnexpectedBuildFailure at TomcatJasperFunctionalTest.groovy:64

com.bmuschko.gradle.tomcat.TomcatJasperFunctionalTest > Throws exception using Jasper compiler validation for Tomcat version 6.0.39 with invalid attribute validateXml FAILED
    org.spockframework.runtime.ConditionNotSatisfiedError at TomcatJasperFunctionalTest.groovy:94

com.bmuschko.gradle.tomcat.TomcatJasperFunctionalTest > Throws exception using Jasper compiler validation for Tomcat version 7.0.42 with invalid attribute validateTld FAILED
    org.spockframework.runtime.ConditionNotSatisfiedError at TomcatJasperFunctionalTest.groovy:94

com.bmuschko.gradle.tomcat.TomcatJasperFunctionalTest > Throws exception using Jasper compiler validation for Tomcat version 8.0.3 with invalid attribute validateXml FAILED
    org.spockframework.runtime.ConditionNotSatisfiedError at TomcatJasperFunctionalTest.groovy:94
[...]

@patric-r
Copy link

@bmuschko any help is still appreciated.

Currently, gradle-tomcat-plugin is not working with gradle 7.x at all
It would be very nice to get this finally fixed.

@jshiell
Copy link
Author

jshiell commented Jun 11, 2021

For the record, we moved to embedding Tomcat in the app, which nicely avoids this problem.

@patric-r
Copy link

patric-r commented Jun 11, 2021

@jshiell Thanks for the info. However, we're using this plugin solely for validating our web application (especially jsp compilation) during ci/release builds

@bmuschko
Copy link
Owner

@patric-r Those tests pass for me on my local machine as well as on CI. Are you executing the build with the checked-in Gradle Wrapper? Have a look at the test report for that source set to see the stack trace. I can't possibly know what's wrong with your test execution without seeing the stack trace.

@patric-r
Copy link

@bmuschko I did further investigating in the past hours. The reason is that the functional tests seems to try to download dependencies from the maven repository and testkits GradleRunner does not read the gradle.properties (due to test isolation) which means that my proxy settings are not available and therefore a silent timeout happens.
Are you aware of a workaround?

I know that you're busy and searching another maintainer for this project but would you mind fixing this issue?
Most probably, you only have to change a few getters to public. Thanks!

@bmuschko bmuschko added this to the v2.6 milestone Jun 15, 2021
@bmuschko bmuschko self-assigned this Jun 15, 2021
@bmuschko bmuschko added the Bug label Jun 15, 2021
@bmuschko
Copy link
Owner

For reference: 20e46f1

@patric-r
Copy link

@bmuschko Thank you so much! I'll have a look.
One last thing: Any chance for a release containing those fixes?

@bmuschko
Copy link
Owner

@patric-r Yes, I will do so soon. Releasing requires more work on the build as JCenter doesn't exist anymore. Need to switch over all that publishing code to the Gradle plugin portal. Will take me a bit.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants