From 5102d53e20bf0e1b2bde55193d882de1a5cecb68 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Wed, 14 Aug 2024 10:59:06 -0300 Subject: [PATCH] add mavenDefinition to addJavaDefinition --- .../java/generators/build-tool/generator.ts | 7 +++-- generators/java/types.d.ts | 2 ++ .../spring-data-relational/generator.ts | 31 +++++++------------ 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/generators/java/generators/build-tool/generator.ts b/generators/java/generators/build-tool/generator.ts index 9f0e7dcb803e..1ccca6df8eec 100644 --- a/generators/java/generators/build-tool/generator.ts +++ b/generators/java/generators/build-tool/generator.ts @@ -109,7 +109,7 @@ export default class BuildToolGenerator extends BaseApplicationGenerator { }; source.addJavaDefinition = (definition, options) => { - const { dependencies, versions } = definition; + const { dependencies, versions, mavenDefinition } = definition; if (dependencies) { source.addJavaDependencies!( dependencies.filter(dep => { @@ -128,9 +128,12 @@ export default class BuildToolGenerator extends BaseApplicationGenerator { }); } if (application.buildToolGradle) { - source.addGradleDependencyCatalogVersions?.(versions, options); + source.addGradleDependencyCatalogVersions!(versions, options); } } + if (application.buildToolMaven && mavenDefinition) { + source.addMavenDefinition!(mavenDefinition); + } }; source.addJavaDefinitions = ( diff --git a/generators/java/types.d.ts b/generators/java/types.d.ts index 1089ad4359a2..6f8ade8896d2 100644 --- a/generators/java/types.d.ts +++ b/generators/java/types.d.ts @@ -2,6 +2,7 @@ import { RequireOneOrNone } from 'type-fest'; import { BaseApplication } from '../base-application/types.js'; import { GradleApplication, GradleNeedleOptions } from '../gradle/types.js'; import { EditFileCallback } from '../base/api.js'; +import { MavenDefinition } from '../maven/types.js'; import { JavaAnnotation } from './support/add-java-annotation.ts'; export type JavaDependencyVersion = { @@ -27,6 +28,7 @@ export type JavaDependency = JavaArtifact & JavaArtifactVersion; export type JavaDefinition = { versions?: JavaDependencyVersion[]; dependencies?: JavaDependency[]; + mavenDefinition?: MavenDefinition; }; export type JavaNeedleOptions = GradleNeedleOptions; diff --git a/generators/spring-data-relational/generator.ts b/generators/spring-data-relational/generator.ts index b2eff890df3a..dc4be83b0e76 100644 --- a/generators/spring-data-relational/generator.ts +++ b/generators/spring-data-relational/generator.ts @@ -139,6 +139,11 @@ export default class SqlGenerator extends BaseApplicationGenerator