diff --git a/src/main/groovy/nu/studer/gradle/jooq/JooqPlugin.java b/src/main/groovy/nu/studer/gradle/jooq/JooqPlugin.java index f5e7d39a..aab695e9 100644 --- a/src/main/groovy/nu/studer/gradle/jooq/JooqPlugin.java +++ b/src/main/groovy/nu/studer/gradle/jooq/JooqPlugin.java @@ -37,7 +37,7 @@ public void apply(Project project) { JooqExtension jooqExtension = project.getExtensions().create("jooq", JooqExtension.class); // create configuration for the runtime classpath of the jooq code generator (shared by all jooq configuration domain objects) - final Configuration runtimeConfiguration = createJooqGeneratorRuntimeConfiguration(project); + final Configuration runtimeConfiguration = createJooqGeneratorRuntimeConfiguration(project, jooqExtension); // create a jooq task for each jooq configuration domain object jooqExtension.getConfigurations().configureEach(config -> { @@ -80,10 +80,11 @@ private SourceSetContainer getSourceSetsDeprecated(Project project) { * Adds the configuration that holds the classpath to use for invoking jOOQ. Users can add their JDBC driver and any generator extensions they might have. Explicitly add JAXB * dependencies since they have been removed from JDK 9 and higher. Explicitly add Activation dependency since it has been removed from JDK 11 and higher. */ - private static Configuration createJooqGeneratorRuntimeConfiguration(Project project) { + private static Configuration createJooqGeneratorRuntimeConfiguration(Project project, JooqExtension jooqExtension) { Configuration jooqGeneratorRuntime = project.getConfigurations().create("jooqGenerator"); jooqGeneratorRuntime.setDescription("The classpath used to invoke the jOOQ code generator. Add your JDBC driver, generator extensions, and additional dependencies here."); - project.getDependencies().add(jooqGeneratorRuntime.getName(), "org.jooq:jooq-codegen"); + project.getDependencies().addProvider(jooqGeneratorRuntime.getName(), + jooqExtension.getEdition().map(e -> e.getGroupId() + ":jooq-codegen").flatMap(ga -> jooqExtension.getVersion().map(v -> ga + ":" + v))); return jooqGeneratorRuntime; } diff --git a/src/test/groovy/nu/studer/gradle/jooq/JooqFuncTest.groovy b/src/test/groovy/nu/studer/gradle/jooq/JooqFuncTest.groovy index 6b33a916..c25b1134 100644 --- a/src/test/groovy/nu/studer/gradle/jooq/JooqFuncTest.groovy +++ b/src/test/groovy/nu/studer/gradle/jooq/JooqFuncTest.groovy @@ -235,14 +235,14 @@ afterEvaluate { def result = runWithArguments('dependencies', '--configuration', 'jooqGenerator') then: - result.output.contains('org.jooq:jooq-codegen -> 3.19.1') + result.output.contains('org.jooq:jooq-codegen:3.19.1') result.output.contains('org.jooq:jooq:3.19.1') when: result = runWithArguments('dependencies', '--configuration', 'compileClasspath') then: - !result.output.contains('org.jooq:jooq-codegen -> 3.19.1') + !result.output.contains('org.jooq:jooq-codegen:3.19.1') result.output.contains('org.jooq:jooq:3.19.1') } @@ -254,14 +254,14 @@ afterEvaluate { def result = runWithArguments('dependencies', '--configuration', 'jooqGenerator') then: - result.output.contains('org.jooq:jooq-codegen -> 3.16.1') + result.output.contains('org.jooq:jooq-codegen:3.16.1') result.output.contains('org.jooq:jooq:3.16.1') when: result = runWithArguments('dependencies', '--configuration', 'compileClasspath') then: - !result.output.contains('org.jooq:jooq-codegen -> 3.16.1') + !result.output.contains('org.jooq:jooq-codegen:3.16.1') result.output.contains('org.jooq:jooq:3.16.1') } @@ -276,14 +276,14 @@ jooq.version = '3.17.1' def result = runWithArguments('dependencies', '--configuration', 'jooqGenerator') then: - result.output.contains('org.jooq:jooq-codegen -> 3.17.1') + result.output.contains('org.jooq:jooq-codegen:3.17.1') result.output.contains('org.jooq:jooq:3.17.1') when: result = runWithArguments('dependencies', '--configuration', 'compileClasspath') then: - !result.output.contains('org.jooq:jooq-codegen -> 3.17.1') + !result.output.contains('org.jooq:jooq-codegen:3.17.1') result.output.contains('org.jooq:jooq:3.17.1') } @@ -295,14 +295,14 @@ jooq.version = '3.17.1' def result = runWithArguments('dependencies', '--configuration', 'jooqGenerator') then: // resolution (incl. transitive dependencies) fails since the trial artifact is not in a public repository - result.output.contains('org.jooq:jooq-codegen -> org.jooq.trial:jooq-codegen:3.19.1 FAILED') + result.output.contains('org.jooq.trial:jooq-codegen:3.19.1 FAILED') !result.output.contains('org.jooq.trial:jooq:3.19.1') when: result = runWithArguments('dependencies', '--configuration', 'compileClasspath') then: - !result.output.contains('org.jooq:jooq-codegen -> org.jooq.trial:jooq-codegen:3.19.1') + !result.output.contains('org.jooq.trial:jooq-codegen:3.19.1') result.output.contains('org.jooq.trial:jooq:3.19.1 FAILED') } @@ -316,14 +316,14 @@ jooq.edition = nu.studer.gradle.jooq.JooqEdition.PRO def result = runWithArguments('dependencies', '--configuration', 'jooqGenerator') then: // resolution (incl. transitive dependencies) fails since the pro artifact is not in a public repository - result.output.contains('org.jooq:jooq-codegen -> org.jooq.pro:jooq-codegen:3.19.1 FAILED') + result.output.contains('org.jooq.pro:jooq-codegen:3.19.1 FAILED') !result.output.contains('org.jooq.pro:jooq:3.19.1') when: result = runWithArguments('dependencies', '--configuration', 'compileClasspath') then: - !result.output.contains('org.jooq:jooq-codegen -> org.jooq.pro:jooq-codegen:3.19.1') + !result.output.contains('org.jooq.pro:jooq-codegen:3.19.1') result.output.contains('org.jooq.pro:jooq:3.19.1 FAILED') }