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

Could not get unknown property 'farmBeforeIntegrationTest' #233

Open
jeffcjohnson opened this issue Jul 19, 2021 · 11 comments
Open

Could not get unknown property 'farmBeforeIntegrationTest' #233

jeffcjohnson opened this issue Jul 19, 2021 · 11 comments

Comments

@jeffcjohnson
Copy link

I have been using the gretty plugin for years. It worked fine last week but today it began failing even though I didn't change anything related to gradle. Any idea what is going on?

In my gradle file I have:

apply from: "https://raw.github.com/gretty-gradle-plugin/gretty/master/pluginScripts/gretty.plugin"

When I run a gradle task I get:

* What went wrong:
Could not get unknown property 'farmBeforeIntegrationTest' for task set of type org.gradle.api.internal.tasks.DefaultTaskContainer.
@boris-petrov
Copy link
Member

@jeffcjohnson - the way you're using Gretty is very strange. :) Can you try using version 3.0.5 the "normal" way? As for why this fails... I guess this change broke your code... but why that happens we'll have to guess. @f4lco - any ideas?

@jeffcjohnson
Copy link
Author

I didn't set it up, it was done years ago by another developer. However the very first link on the normal way goes to the docs and the very first link on that goes to Getting Started which recommends the way we have it setup.

I'll try the other way and see if it helps.

@jeffcjohnson
Copy link
Author

The normal way does indeed fix the problem. I don't know if the other way suggested by Getting Started should be changed but I'll close this ticket.

Thanks for the help.

@boris-petrov
Copy link
Member

Oh wow, never knew it said that in the Getting started page. Thank you for pointing it out! I'll see if we can fix it.

@jeffcjohnson
Copy link
Author

I'm sorry, the issue was not fixed by changing the the way the plugin is imported after all. I changed to version 3.0.4 and the problem went away.

@jeffcjohnson jeffcjohnson reopened this Jul 27, 2021
@boris-petrov
Copy link
Member

@jeffcjohnson - I couldn't understand what you're saying. Version 3.0.4 does fix the problem? If so, why did you reopen the issue? (also note there is a 3.0.6 version now)

@jeffcjohnson
Copy link
Author

Sorry I wasn't more clear. The problem happens in 3.0.5. Rolling back to 3.0.4 fixes the problem. I tested with 3.0.6 and it also has the problem.

I'm not sure if it helps but the following gretty related lines are in the sub-module gradle.build file that fails:

// use gradle appRun
gretty {
    servletContainer = "tomcat85"
    serverConfigFile = "config/server.xml"
    httpPort = 8080
    httpsPort = 8443
    httpsEnabled = true
    contextPath = "/"
    scanner = "jdk"
    jvmArgs = [
        // "-Dmaintenance.mode=true",
        // "-Dlog4j2.debug",
        "-Dlog4j.configurationFile=file:config/log4j2.xml",
        "-Dspring.config.location=application-override.properties"
    ]
}

// https://stackoverflow.com/questions/33960409/adding-a-dependency-to-a-gretty-task
project.afterEvaluate {
    if (!project.state.failure) {
        dockerCompose.isRequiredBy(appRun)
    }
}

The error is:

* What went wrong:
Could not get unknown property 'farmBeforeIntegrationTest' for task set of type org.gradle.api.internal.tasks.DefaultTaskContainer.

@boris-petrov
Copy link
Member

Thank you, that makes it clear now.

3.0.5 was the first release that we did on Maven Central. I wonder if we're not releasing all artifacts or something... @f4lco - any ideas?

@jeffcjohnson
Copy link
Author

@boris-petrov I hope this helps:

groovy.lang.MissingPropertyException: Could not get unknown property 'farmBeforeIntegrationTest' for task set of type org.gradle.api.internal.tasks.DefaultTaskContainer.
        at org.gradle.internal.metaobject.AbstractDynamicObject.getMissingProperty(AbstractDynamicObject.java:85)
        at org.gradle.internal.metaobject.AbstractDynamicObject.getProperty(AbstractDynamicObject.java:62)
        at org.gradle.api.internal.tasks.DefaultTaskContainer_Decorated.getProperty(Unknown Source)
        at org.akhikhl.gretty.GrettyPlugin$_afterAllProjectsEvaluate_closure61$_closure114.doCall(GrettyPlugin.groovy:813)

Lines 812-814:

          // FIXME does not use task configuration avoidance #41
          if(!project.tasks."farmBeforeIntegrationTest$fname".integrationTestTaskAssigned)
            project.tasks."farmBeforeIntegrationTest$fname".integrationTestTask null // default binding

@f4lco
Copy link
Collaborator

f4lco commented Aug 20, 2021

@boris-petrov no I don't have an idea, just forensics: the problem solved in 3.04, but happens in 3.05. So, the diff is v3.0.4...gretty-gradle-plugin:v3.0.5, and from that range of commits I think e2e9a09 appears related, maybe we forgot about a corner case?

EDIT: that commit might be a candidate for revert, but to my belief, we fixed some Gradle deprecation with it., so this route might not work.

@boris-petrov
Copy link
Member

Yes, absolutely, we can't revert it as Gretty will stop working on Gradle 7.

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

No branches or pull requests

3 participants