diff --git a/src/main/java/tech/jhipster/lite/generator/buildtool/maven/README.md b/src/main/java/tech/jhipster/lite/generator/buildtool/maven/README.md new file mode 100644 index 00000000000..12b8d13fc03 --- /dev/null +++ b/src/main/java/tech/jhipster/lite/generator/buildtool/maven/README.md @@ -0,0 +1,19 @@ +# Maven + +## Description + +This context is used to add Maven to an existing project: + +- `pom.xml` for Java with some libraries +- maven wrapper + +This context is used by other contexts for: + +- managing dependencies +- adding properties +- adding plugins +- etc. + +## Maintainers + +- [Pascal Grimaud](https://github.com/pascalgrimaud) diff --git a/src/main/java/tech/jhipster/lite/generator/buildtool/maven/infrastructure/primary/rest/MavenResource.java b/src/main/java/tech/jhipster/lite/generator/buildtool/maven/infrastructure/primary/rest/MavenResource.java index c6c1f6893c6..acf2e6d5732 100644 --- a/src/main/java/tech/jhipster/lite/generator/buildtool/maven/infrastructure/primary/rest/MavenResource.java +++ b/src/main/java/tech/jhipster/lite/generator/buildtool/maven/infrastructure/primary/rest/MavenResource.java @@ -27,7 +27,7 @@ public MavenResource(MavenApplicationService mavenApplicationService) { @Operation(summary = "Init", description = "Init Maven project with pom.xml and wrapper") @ApiResponse(responseCode = "500", description = "An error occurred while initializing Maven project") @PostMapping - @GeneratorStep(id = GeneratorAction.MAVEN) + @GeneratorStep(id = GeneratorAction.MAVEN_JAVA) public void init(@RequestBody ProjectDTO projectDTO) { Project project = ProjectDTO.toProject(projectDTO); mavenApplicationService.init(project); @@ -36,7 +36,7 @@ public void init(@RequestBody ProjectDTO projectDTO) { @Operation(summary = "Add pom.xml") @ApiResponse(responseCode = "500", description = "An error occurred while adding pom.xml to project") @PostMapping("/pom-xml") - @GeneratorStep(id = GeneratorAction.POM_XML) + @GeneratorStep(id = GeneratorAction.MAVEN_JAVA_POM_XML) public void addPomXml(@RequestBody ProjectDTO projectDTO) { Project project = ProjectDTO.toProject(projectDTO); mavenApplicationService.addPomXml(project); diff --git a/src/main/java/tech/jhipster/lite/generator/project/domain/GeneratorAction.java b/src/main/java/tech/jhipster/lite/generator/project/domain/GeneratorAction.java index ade472279e8..f4af11bc1fd 100644 --- a/src/main/java/tech/jhipster/lite/generator/project/domain/GeneratorAction.java +++ b/src/main/java/tech/jhipster/lite/generator/project/domain/GeneratorAction.java @@ -4,10 +4,15 @@ public class GeneratorAction { private GeneratorAction() {} - // init + // Init public static final String INIT = "init"; public static final String DOWNLOAD = "download"; + // Maven + public static final String MAVEN_JAVA = "maven-java"; + public static final String MAVEN_JAVA_POM_XML = "maven-java-pom-xml"; + public static final String MAVEN_WRAPPER = "maven-wrapper"; + public static final String NPM_INSTALL = "npm-install"; public static final String NPM_PRETTIFY = "npm-prettify"; @@ -25,10 +30,6 @@ private GeneratorAction() {} public static final String SVELTE = "svelte"; public static final String SVEKTEKIT_STYLE = "svektekit-styled"; - public static final String MAVEN = "maven"; - public static final String POM_XML = "pom.xml"; - public static final String MAVEN_WRAPPER = "maven-wrapper"; - public static final String CONSUL = "consul"; public static final String EHCACHE_WITH_JAVA_CONFIG = "ehcache-with-java-config"; diff --git a/src/test/java/tech/jhipster/lite/generator/history/infrastructure/primary/HistoryResourceIT.java b/src/test/java/tech/jhipster/lite/generator/history/infrastructure/primary/HistoryResourceIT.java index f24a2ecf6a4..e6b011aea54 100644 --- a/src/test/java/tech/jhipster/lite/generator/history/infrastructure/primary/HistoryResourceIT.java +++ b/src/test/java/tech/jhipster/lite/generator/history/infrastructure/primary/HistoryResourceIT.java @@ -13,6 +13,7 @@ import tech.jhipster.lite.TestUtils; import tech.jhipster.lite.common.domain.FileUtils; import tech.jhipster.lite.error.domain.GeneratorException; +import tech.jhipster.lite.generator.project.domain.GeneratorAction; import tech.jhipster.lite.generator.project.infrastructure.primary.dto.ProjectDTO; @IntegrationTest @@ -53,8 +54,8 @@ void shouldGetHistory() throws Exception { .perform(get("/api/projects/history").param("folder", projectDTO.getFolder())) .andExpect(status().isOk()) .andExpect(jsonPath("$.serviceIds", Matchers.hasSize(3))) - .andExpect(jsonPath("$.serviceIds[0]").value("init")) - .andExpect(jsonPath("$.serviceIds[1]").value("maven")) - .andExpect(jsonPath("$.serviceIds[2]").value("github-actions")); + .andExpect(jsonPath("$.serviceIds[0]").value(GeneratorAction.INIT)) + .andExpect(jsonPath("$.serviceIds[1]").value(GeneratorAction.MAVEN_JAVA)) + .andExpect(jsonPath("$.serviceIds[2]").value(GeneratorAction.GITHUB_ACTIONS)); } }