Beautiful!

Thanks everyone for the help!

On Fri, 23 Feb 2024, 10:38 Lukas Eder, <lukas.e...@gmail.com> wrote:

> Hi Pasha,
>
> Yes, see this issue for lazy configuration evaluation:
> https://github.com/jOOQ/jOOQ/issues/16188
>
> On Fri, Feb 23, 2024 at 8:24 AM Pasha Finkelshtein <
> pavel.finkelsht...@gmail.com> wrote:
>
>> Hi @Lukas,
>>
>> After some experimenting, I think that I hit an issue with the jOOQ
>> Gradle plugin, or maybe it's lack of my understanding.
>>
>> Thq jooq block requires jdbc URL to be known in advance, in the
>> configuration phase. But in a perfect world, I need the docker to be run
>> only in the execution phase.
>>
>> For example, this code works:
>>
>> val start by tasks.registering(Container::class) {
>>     println("START CONTAINER")
>>     container = parade
>> //    doLast {
>>         start()
>> //    }
>> }
>>
>> abstract class Container : DefaultTask() {
>>     @get:Input
>>     abstract val container: Property<PostgreSQLContainer<*>>
>>
>>     fun start() {
>>         container.get().start()
>>     }
>>
>>     fun stop() {
>>         container.get().stop()
>>     }
>> }
>>
>> But if I uncomment ths "doLast" line, I get an error
>>
>> * What went wrong:
>> Mapped port can only be obtained after the container is started
>>
>> I think that the jdbc block should be lazy and read its parameters only
>> during execution. It might be true for other blocks too — hypothetically
>> other tasks can augment reality with parts later used by jOOQ too.
>>
>> On Thursday 22 February 2024 at 14:44:48 UTC+1 Pasha Finkelshtein wrote:
>>
>>> Now I have a relatively full picture, thank you very much!
>>>
>>> On Thursday 22 February 2024 at 14:40:10 UTC+1 HOMERMAN wrote:
>>>
>>>> It's on the buildscript's classpath. So from the very top of my build
>>>> script it looks like this:
>>>>
>>>> import liquibase.Liquibase
>>>> import liquibase.database.DatabaseFactory
>>>> import liquibase.database.jvm.JdbcConnection
>>>> import liquibase.resource.DirectoryResourceAccessor
>>>> import org.jooq.codegen.DefaultGeneratorStrategy
>>>> import org.jooq.codegen.GenerationTool
>>>> import org.jooq.meta.jaxb.Configuration
>>>> import org.jooq.meta.jaxb.Database
>>>> import org.jooq.meta.jaxb.Generate
>>>> import org.jooq.meta.jaxb.Generator
>>>> import org.jooq.meta.jaxb.Jdbc
>>>> import org.jooq.meta.jaxb.Strategy
>>>> import org.jooq.meta.jaxb.Target
>>>> import org.jooq.meta.postgres.PostgresDatabase
>>>> import org.testcontainers.containers.PostgreSQLContainer
>>>> import java.sql.DriverManager
>>>>
>>>> buildscript {
>>>>    repositories {
>>>>      mavenCentral()
>>>>    }
>>>>
>>>>   dependencies {
>>>>
>>>> classpath("org.testcontainers:testcontainers:${rootProject.extra["testcontainersBomVersion"]}")
>>>>
>>>> classpath("org.testcontainers:junit-jupiter:${rootProject.extra["testcontainersBomVersion"]}")
>>>>
>>>> classpath("org.testcontainers:postgresql:${rootProject.extra["testcontainersBomVersion"]}")
>>>>
>>>> classpath("org.liquibase:liquibase-core:${rootProject.extra["liquibaseVersion"]}")
>>>>     classpath("org.jooq:jooq:${rootProject.extra["jooqVersion"]}")
>>>>     classpath("org.jooq:jooq-meta:${rootProject.extra["jooqVersion"]}")
>>>>
>>>> classpath("org.jooq:jooq-codegen:${rootProject.extra["jooqVersion"]}")
>>>>
>>>> classpath("org.postgresql:postgresql:${rootProject.extra["postgresVersion"]}")
>>>>   }
>>>> }
>>>>
>>>> tasks.register("jooqGenerate") {
>>>>    ...
>>>> }
>>>>
>>>> On Thursday, February 22, 2024 at 10:31:27 PM UTC+9 Pasha Finkelshtein
>>>> wrote:
>>>>
>>>>> Thanks HOMERMAN,
>>>>>
>>>>> But where does this import come from? Where is the dependency declared?
>>>>> Is it in the usual dependencies section? With which scope?
>>>>>
>>>>>
>>>>>
>>>>> On Thursday 22 February 2024 at 14:24:36 UTC+1 HOMERMAN wrote:
>>>>>
>>>>>> @Pasha
>>>>>>
>>>>>> Sorry - I copy/pasted/genericized before I shared, and I think
>>>>>> inadvertently snipped the import out along the way:
>>>>>>
>>>>>> import org.testcontainers.containers.PostgreSQLContainer
>>>>>>
>>>>>>
>>>>>> On Thursday, February 22, 2024 at 10:06:49 PM UTC+9 Pasha
>>>>>> Finkelshtein wrote:
>>>>>>
>>>>>>> Thanks HOMERMAN,
>>>>>>>
>>>>>>> Where does the dependency on PostgreSQLContainer come from? I don't
>>>>>>> see neither imports nor dependency declaration...
>>>>>>>
>>>>>>> Best,
>>>>>>> Pasha
>>>>>>>
>>>>>> --
>> You received this message because you are subscribed to the Google Groups
>> "jOOQ User Group" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to jooq-user+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jooq-user/b901ed42-ecef-4738-8385-dacc6af3cc2bn%40googlegroups.com
>> <https://groups.google.com/d/msgid/jooq-user/b901ed42-ecef-4738-8385-dacc6af3cc2bn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "jOOQ User Group" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/jooq-user/WYKlwguBHwE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> jooq-user+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jooq-user/CAB4ELO6JqDRmNgH92zdja4pGquGXQApH86uXT2k4w8fAs1CNeg%40mail.gmail.com
> <https://groups.google.com/d/msgid/jooq-user/CAB4ELO6JqDRmNgH92zdja4pGquGXQApH86uXT2k4w8fAs1CNeg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jooq-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jooq-user/CAO4yE_ZtA%2B8Jx8FF6-AOdAw%2B0Xdh%3D8MzhGq%2B5dW2JFw2N6_hXg%40mail.gmail.com.

Reply via email to