Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propetry 'failOnMissingInput' of type boolean shouldn't be annotated with @Optional. #98

Closed
roded opened this issue Nov 12, 2023 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@roded
Copy link

roded commented Nov 12, 2023

Describe the bug
Trying to migrate from 0.6.1 to 0.7.0 and Gradle is reporting the following error:

A problem was found with the configuration of GenerateAndAggregateDocumentsTask[metadataInputs=[], documentName='Configuration Options', documentDescription='model9-cdp-agent configuration options', type=ADOC, htmlCustomization=HtmlTemplateCustomization[backgroundColor='#7db04b', linkColor='black', collapsibleHoverColor='#96d95c', codeColor='#eeeeee', evenTableRowColor='#f3f3f3', lastTableRowColor='#009879', tableRowColor='#ffffff', tableRowBorderColor='#dddddd', textColor='black', tocTitle='null', headerEnabled=true, tableOfContentsEnabled=true, includeUnknownGroup=true, unknownGroupLocalization='Unknown group', includeGenerationDate=true, removeEmptyGroups=false, locale='null', contentCustomization=ContentCustomization[includeClass=true, includeKey=true, includeType=true, includeDescription=true, includeDefaultValue=true, includeDeprecation=true, includeEnvFormat=false], templateMode=STANDARD], markdownCustomization=AbstractTemplateCustomization[tocTitle='null', headerEnabled=true, tableOfContentsEnabled=true, includeUnknownGroup=true, unknownGroupLocalization='Unknown group', includeGenerationDate=true, removeEmptyGroups=false, locale='null', contentCustomization=ContentCustomization[includeClass=true, includeKey=true, includeType=true, includeDescription=true, includeDefaultValue=true, includeDeprecation=true, includeEnvFormat=false], templateMode=STANDARD], asciiDocCustomization=AsciiDocTemplateCustomization[tocPlacement=AUTO, tocLevels=4, tocTitle='null', headerEnabled=true, tableOfContentsEnabled=true, includeUnknownGroup=false, unknownGroupLocalization='Unknown group', includeGenerationDate=false, removeEmptyGroups=true, locale='null', contentCustomization=ContentCustomization[includeClass=true, includeKey=true, includeType=true, includeDescription=true, includeDefaultValue=true, includeDeprecation=false, includeEnvFormat=false], templateMode=COMPACT], xmlCustomization=AbstractTemplateCustomization[tocTitle='null', headerEnabled=true, tableOfContentsEnabled=true, includeUnknownGroup=true, unknownGroupLocalization='Unknown group', includeGenerationDate=true, removeEmptyGroups=false, locale='null', contentCustomization=ContentCustomization[includeClass=true, includeKey=true, includeType=true, includeDescription=true, includeDefaultValue=true, includeDeprecation=true, includeEnvFormat=false], templateMode=STANDARD], outputFile=/Users/rbahat/dev/model9-backup/model9-cdp/model9-cdp-agent/model9-cdp-agent/docs/modules/ROOT/pages/configuration-options.adoc, templateCompilerName='org.rodnansol.core.generator.template.handlebars.HandlebarsTemplateCompiler', headerTemplate='null', contentTemplate='null', footerTemplate='null', failOnMissingInput=true] (type 'GenerateAndAggregateDocumentsTask').
  - In plugin 'org.rodnansol.spring-configuration-property-documenter' type 'org.rodnansol.gradle.tasks.GenerateAndAggregateDocumentsTask' property 'failOnMissingInput' of type boolean shouldn't be annotated with @Optional.

To Reproduce
The GenerateAndAggregateDocumentsTask task I'm trying to migrate looks like:

val configDocsModel9CdpAgent = tasks.register<GenerateAndAggregateDocumentsTask>("configDocsModel9CdpAgent") {
    documentName = "Configuration Options"
    documentDescription = "model9-cdp-agent configuration options"
    type = TemplateType.ADOC
    isFailOnMissingInput = true
    outputFile = file("${projectDir}/model9-cdp-agent/model9-cdp-agent/docs/modules/ROOT/pages/configuration-options.adoc")

    asciiDocCustomization(delegateClosureOf<AsciiDocTemplateCustomization> {
        isIncludeUnknownGroup = false
        isIncludeGenerationDate = false
        isRemoveEmptyGroups = true
        templateMode = TemplateMode.COMPACT
        contentCustomization(delegateClosureOf<ContentCustomization> {
            isIncludeDeprecation = false
        })
    })

    // TODO (rodedb): Calculate dependent modules at runtime
    val cdpAgentModule = AggregationInput()
    cdpAgentModule.name = "model9-cdp-agent"
    cdpAgentModule.input = file("${projectDir}/model9-cdp-agent/model9-cdp-agent")
    metadataInputs.add(cdpAgentModule)

    val awsStarterModule = AggregationInput()
    awsStarterModule.name = "model9-cdp-starter-aws"
    awsStarterModule.input = file("model9-cdp-spring-boot/model9-cdp-starter-aws-springboot2")
    metadataInputs.add(awsStarterModule)

    outputs.upToDateWhen { false }
}

Not sure if this is a bug or incorrect usage on my part, any help would be appreciated.
Using Gradle 7.6.2

TY

@roded roded added the bug Something isn't working label Nov 12, 2023
@nandorholozsnyak
Copy link
Member

Hi @roded
Let me check this as soon as I have time for it.

@roded
Copy link
Author

roded commented Nov 13, 2023

Much obliged @nandorholozsnyak

@NunoCardia
Copy link

NunoCardia commented Jan 26, 2024

Any news on this @nandorholozsnyak ? I'm having the exact same problem with a similar configuration of the plugin. Gradle outputs this:

Reason: Properties of primitive type cannot be optional. 
Possible solutions:
  1. Remove the @Optional annotation.
  2. Use the java.lang.Boolean type instead.`

@nandorholozsnyak
Copy link
Member

Hello @NunoCardia
Unfortunately I did not have time to check it properly yet, I'm not really having enough time nowadays, but this weekend I try to find some time for it.

Of course, contributions are welcome, but I know it is also not an option for every issue like this :)

nandorholozsnyak added a commit that referenced this issue Jan 27, 2024
… annotated with @optional. -  #98

- @optional is removed from two boolean properties in the different Gradle tasks
- Kotlin based example is added
@nandorholozsnyak
Copy link
Member

nandorholozsnyak commented Jan 27, 2024

Hello @roded & @NunoCardia

I made a fix for that, I'm not sure how it will work on the long run, and I hope that nothing is broken after it. I'm not familiar with Gradle, and I have already encountered a few "caching" related traps during development.

I'm opening a PR soon. I would like to ask you to verify the behaviour if possible by checking out the branch and building the project, after that you should use the 999-SNAPSHOT version in your project and just run the tasks/goals that failed before.

Here it is: #101

@NunoCardia
Copy link

Hi @nandorholozsnyak thank you for the quick response. I´ve built the project and it works now, no errors! Are you able to create a patch release of some sort?

@nandorholozsnyak
Copy link
Member

Hi @nandorholozsnyak thank you for the quick response. I´ve built the project and it works now, no errors! Are you able to create a patch release of some sort?

Yes I will try to do a release today.

nandorholozsnyak added a commit that referenced this issue Jan 28, 2024
… annotated with @optional. -  #98 (#101)

- @optional is removed from two boolean properties in the different Gradle tasks
- Kotlin based example is added
@nandorholozsnyak
Copy link
Member

Fixed with #101

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants