Skip to content

Commit

Permalink
feat: change root project from parent project to aggregator project
Browse files Browse the repository at this point in the history
  • Loading branch information
khalilou88 committed Oct 15, 2024
1 parent 7dd6aa6 commit 247be4a
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 23 deletions.
2 changes: 1 addition & 1 deletion packages/common/src/lib/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export type TargetsType = Record<string, TargetConfiguration>;
export type FrameworkType = 'spring-boot' | 'quarkus' | 'micronaut' | 'none';
export type PresetType = 'spring-boot' | 'quarkus' | 'micronaut' | 'none';
export type DependencyManagementType =
| 'bom'
| 'none'
| 'spring-boot-parent-pom'
| 'micronaut-parent-pom';
export type VersionManagementType = 'properties' | 'version-catalog';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId><%= groupId %></groupId>
<artifactId><%= parentProjectName %></artifactId>
<version><%= parentProjectVersion %></version>
<groupId><%= aggregatorProjectGroupId %></groupId>
<artifactId><%= aggregatorProjectName %></artifactId>
<version><%= aggregatorProjectVersion %></version>
<packaging>pom</packaging>

<% if(dependencyManagement === 'spring-boot-parent-pom') { -%>
Expand Down
2 changes: 1 addition & 1 deletion packages/nx-maven/src/generators/init/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export async function initGenerator(

addProjectConfiguration(
tree,
normalizedOptions.parentProjectName,
normalizedOptions.aggregatorProjectName,
projectConfiguration,
);
}
Expand Down
6 changes: 3 additions & 3 deletions packages/nx-maven/src/generators/init/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { DependencyManagementType } from '@jnxplus/common';

export interface NxMavenInitGeneratorSchema {
javaVersion: string | number;
groupId: string;
parentProjectName: string;
parentProjectVersion: string;
aggregatorProjectGroupId: string;
aggregatorProjectName: string;
aggregatorProjectVersion: string;
mavenRootDirectory: string;
dependencyManagement: DependencyManagementType;
skipWrapper?: boolean;
Expand Down
30 changes: 16 additions & 14 deletions packages/nx-maven/src/generators/init/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,25 @@
]
}
},
"groupId": {
"aggregatorProjectGroupId": {
"type": "string",
"default": "com.example",
"x-prompt": "What groupId would you like to use?"
"description": "GroupId of root aggregator project",
"x-prompt": "What groupId would you like to use for root aggregator project?"
},
"parentProjectName": {
"aggregatorProjectName": {
"type": "string",
"default": "root-parent-project",
"x-prompt": "What parentProjectName would you like to use?",
"default": "root-aggregator-project",
"description": "Name of root aggregator project",
"x-prompt": "What name would you like to use for root aggregator project?",
"pattern": "^[a-zA-Z].*$"
},
"parentProjectVersion": {
"aggregatorProjectVersion": {
"type": "string",
"default": "0.0.1-SNAPSHOT",
"description": "Version of the project to generate",
"description": "Version of root aggregator project",
"alias": "v",
"x-prompt": "What project version would you like to use?"
"x-prompt": "What version would you like to use for root aggregator project?"
},
"mavenRootDirectory": {
"type": "string",
Expand All @@ -57,14 +59,14 @@
"dependencyManagement": {
"description": "Dependency Management",
"type": "string",
"default": "bom",
"default": "none",
"x-prompt": {
"message": "How to manage dependencies?",
"type": "list",
"items": [
{
"value": "bom",
"label": "I will generate later a parent project with Maven BOM (Spring Boot, Quarkus or Micronaut)"
"value": "none",
"label": "I will generate later a parent project and keep the root project for modules aggregation"
},
{
"value": "spring-boot-parent-pom",
Expand Down Expand Up @@ -115,9 +117,9 @@
},
"required": [
"javaVersion",
"groupId",
"parentProjectName",
"parentProjectVersion",
"aggregatorProjectGroupId",
"aggregatorProjectName",
"aggregatorProjectVersion",
"mavenRootDirectory",
"dependencyManagement",
"localRepoRelativePath"
Expand Down
2 changes: 1 addition & 1 deletion packages/nx-maven/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ function getDependencyManagement(
return 'micronaut-parent-pom';
}

return 'bom';
return 'none';
}

function getLocalRepoRelativePath(): string {
Expand Down

0 comments on commit 247be4a

Please sign in to comment.