diff --git a/.cursor/rules/112-java-maven-plugins.md b/.cursor/rules/112-java-maven-plugins.md index 1b82bc3d..1a637b93 100644 --- a/.cursor/rules/112-java-maven-plugins.md +++ b/.cursor/rules/112-java-maven-plugins.md @@ -121,6 +121,7 @@ Options: - Security static code analysis (SpotBugs, PMD) - Sonar - Version management +- Container image build (Jib) - JMH (Java Microbenchmark Harness) - Maven Compiler - Cyclomatic Complexity @@ -129,6 +130,15 @@ Options: --- +**Question 3.1** (conditional): What is your target container image for Jib? + +**Note**: This question is only asked if "Container image build (Jib)" was selected in question 3. + +- Example format: `gcr.io/my-project/my-app`, `docker.io/username/myimage`, or `myimage` for local Docker +- The image name will be used in the Jib plugin `` configuration + +--- + **Question 4**: What is your target coverage threshold? Options: @@ -204,9 +214,10 @@ Options: - **MUST NOT** ask all questions simultaneously - **MUST NOT** assume answers or provide defaults - **MUST NOT** skip questions or change their order -- **MUST** follow question sequence: Project Nature → Java Version → Build and Quality Aspects → Coverage Threshold (conditional) → Sonar Configuration (conditional) → Sonar Host Configuration (conditional) +- **MUST** follow question sequence: Project Nature → Java Version → Build and Quality Aspects → Jib Image (conditional) → Coverage Threshold (conditional) → Sonar Configuration (conditional) → Sonar Host Configuration (conditional) - **MUST** confirm understanding of user selections before proceeding to Step 4 - **MUST NOT** ask about Coverage Threshold if user did not select jacoco coverage +- **MUST** ask Question 3.1 (target container image) if "Container image build (Jib)" was selected in Question 3 ### Step 4: Properties Configuration @@ -361,6 +372,11 @@ Start with essential build properties that every project needs (use the Java ver 3.6.0 ``` +**If Container image build (Jib) selected**: +```xml +3.5.1 +``` + The final `` section will look like this (example with common selections): ```xml @@ -382,6 +398,7 @@ The final `` section will look like this (example with common select 4.9.3.0 3.13.0 + 80 @@ -2099,11 +2116,86 @@ After adding this profile, verify the configuration: - **MUST** use properties configured in Step 4 for plugin versions - **MUST** skip this step entirely if Cyclomatic Complexity was not selected +### Step 21: Jib Maven Plugin Configuration + +**Purpose**: Configure Jib Maven plugin for building container images without Docker daemon, using the image name provided in Step 3.1. + +**Dependencies**: Only execute if user selected "Container image build (Jib)" in Step 3. Requires completion of core plugin steps (3, 4, 5). + +**CRITICAL PRESERVATION RULE**: Only ADD this plugin if it doesn't already exist. Never REPLACE or REMOVE existing plugins. + +## Pre-Implementation Check + +**BEFORE adding Jib plugin, check if it already exists in the pom.xml:** + +If jib-maven-plugin already exists: Ask user "Jib plugin already exists. Do you want to enhance the existing configuration? (y/n)" + +If user says "n": Skip this step entirely. +If user says "y": Proceed with adding missing configuration elements only. + +**CONDITIONAL EXECUTION**: Only execute this step if user selected "Container image build (Jib)" in Step 3. + +## Implementation Guidelines + +1. **Replace image placeholder**: Use the target container image from Question 3.1 (e.g., `gcr.io/my-project/my-app`, `docker.io/username/myimage`, or `myimage` for local Docker) +2. **No Docker daemon required**: Jib builds images directly; useful for CI/CD and local development + +## Jib Plugin Configuration + +**ADD this plugin to the `` section ONLY if it doesn't already exist:** + +```xml + + com.google.cloud.tools + jib-maven-plugin + ${maven-plugin-jib.version} + + + REPLACE_WITH_ACTUAL_IMAGE + + + +``` + +**Replace `REPLACE_WITH_ACTUAL_IMAGE`** with the value from Question 3.1 (e.g., `myimage`, `gcr.io/my-project/my-app`). + +## Usage Examples + +```bash +# Build container image (no Docker daemon required) +./mvnw compile jib:build + +# Build to Docker daemon (for local testing) +./mvnw compile jib:dockerBuild + +# Build image tarball +./mvnw compile jib:buildTar +``` + +## Validation + +After adding this plugin, verify the configuration: + +```bash +# Validate plugin configuration +./mvnw validate +``` + + +#### Step Constraints + +- **MUST** only add Jib plugin if "Container image build (Jib)" was selected in Step 3 +- **MUST** check if plugin already exists before adding +- **MUST** ask user permission before modifying existing plugin configuration +- **MUST** use properties configured in Step 4 for plugin version +- **MUST** replace REPLACE_WITH_ACTUAL_IMAGE with the target container image from Question 3.1 +- **MUST** skip this step entirely if Container image build (Jib) was not selected + ## Output Format - Ask questions one by one following the template exactly in Step 3 -- Execute steps 4-20 only based on user selections from Step 3 +- Execute steps 4-21 only based on user selections from Step 3 - Skip entire steps if no relevant features were selected - Implement only requested features based on user selections - Follow template specifications exactly for all configurations diff --git a/skills-generator/src/main/resources/skills/112-skill.xml b/skills-generator/src/main/resources/skills/112-skill.xml index 57cb5eb0..84021edf 100644 --- a/skills-generator/src/main/resources/skills/112-skill.xml +++ b/skills-generator/src/main/resources/skills/112-skill.xml @@ -10,19 +10,34 @@ Maven Plugins: pom.xml Configuration Best Practices - Use when you need to add or configure Maven plugins in your pom.xml — including quality tools (enforcer, surefire, failsafe, jacoco, pitest, spotbugs, pmd), security scanning (OWASP), code formatting (Spotless), version management, build information tracking, and benchmarking (JMH) — through a consultative, modular step-by-step approach that only adds what you actually need. + Use when you need to add or configure Maven plugins in your pom.xml — including quality tools (enforcer, surefire, failsafe, jacoco, pitest, spotbugs, pmd), security scanning (OWASP), code formatting (Spotless), version management, container image build (Jib), build information tracking, and benchmarking (JMH) — through a consultative, modular step-by-step approach that only adds what you actually need. diff --git a/skills/112-java-maven-plugins/SKILL.md b/skills/112-java-maven-plugins/SKILL.md index 5b655111..eaab8d29 100644 --- a/skills/112-java-maven-plugins/SKILL.md +++ b/skills/112-java-maven-plugins/SKILL.md @@ -1,6 +1,6 @@ --- name: 112-java-maven-plugins -description: Use when you need to add or configure Maven plugins in your pom.xml — including quality tools (enforcer, surefire, failsafe, jacoco, pitest, spotbugs, pmd), security scanning (OWASP), code formatting (Spotless), version management, build information tracking, and benchmarking (JMH) — through a consultative, modular step-by-step approach that only adds what you actually need. Part of the skills-for-java project +description: Use when you need to add or configure Maven plugins in your pom.xml — including quality tools (enforcer, surefire, failsafe, jacoco, pitest, spotbugs, pmd), security scanning (OWASP), code formatting (Spotless), version management, container image build (Jib), build information tracking, and benchmarking (JMH) — through a consultative, modular step-by-step approach that only adds what you actually need. Part of the skills-for-java project license: Apache-2.0 metadata: author: Juan Antonio Breña Moral @@ -12,13 +12,28 @@ Configure Maven plugins and profiles in pom.xml using a structured, question-dri **What is covered in this Skill?** -- Existing configuration analysis and preservation, Maven Wrapper verification -- Project assessment questions: project nature, Java version, build and quality aspects -- Properties configuration, Maven Enforcer, Surefire, Failsafe, HTML test reports -- JaCoCo coverage, PiTest mutation testing, OWASP security scanning -- SpotBugs/PMD static analysis, SonarQube/SonarCloud -- Spotless code formatting, Versions plugin, Git Commit ID, Flatten plugin -- JMH benchmarking, Maven Compiler, cyclomatic complexity analysis +Maven plugins: + +- Maven Compiler +- Maven Enforcer +- Maven Surefire +- Maven Failsafe +- HTML test reports (Surefire Report, JXR) +- Maven Spotless +- Maven Flatten +- Maven Versions +- Maven Git Commit ID +- Maven Jib + +Maven profiles: + +- JaCoCo (code coverage) +- PiTest (mutation testing) +- Security (OWASP dependency check) +- Static analysis (SpotBugs, PMD) +- SonarQube/SonarCloud +- JMH (Java Microbenchmark Harness) +- Cyclomatic complexity ## Constraints diff --git a/skills/112-java-maven-plugins/references/112-java-maven-plugins.md b/skills/112-java-maven-plugins/references/112-java-maven-plugins.md index 1b82bc3d..1a637b93 100644 --- a/skills/112-java-maven-plugins/references/112-java-maven-plugins.md +++ b/skills/112-java-maven-plugins/references/112-java-maven-plugins.md @@ -121,6 +121,7 @@ Options: - Security static code analysis (SpotBugs, PMD) - Sonar - Version management +- Container image build (Jib) - JMH (Java Microbenchmark Harness) - Maven Compiler - Cyclomatic Complexity @@ -129,6 +130,15 @@ Options: --- +**Question 3.1** (conditional): What is your target container image for Jib? + +**Note**: This question is only asked if "Container image build (Jib)" was selected in question 3. + +- Example format: `gcr.io/my-project/my-app`, `docker.io/username/myimage`, or `myimage` for local Docker +- The image name will be used in the Jib plugin `` configuration + +--- + **Question 4**: What is your target coverage threshold? Options: @@ -204,9 +214,10 @@ Options: - **MUST NOT** ask all questions simultaneously - **MUST NOT** assume answers or provide defaults - **MUST NOT** skip questions or change their order -- **MUST** follow question sequence: Project Nature → Java Version → Build and Quality Aspects → Coverage Threshold (conditional) → Sonar Configuration (conditional) → Sonar Host Configuration (conditional) +- **MUST** follow question sequence: Project Nature → Java Version → Build and Quality Aspects → Jib Image (conditional) → Coverage Threshold (conditional) → Sonar Configuration (conditional) → Sonar Host Configuration (conditional) - **MUST** confirm understanding of user selections before proceeding to Step 4 - **MUST NOT** ask about Coverage Threshold if user did not select jacoco coverage +- **MUST** ask Question 3.1 (target container image) if "Container image build (Jib)" was selected in Question 3 ### Step 4: Properties Configuration @@ -361,6 +372,11 @@ Start with essential build properties that every project needs (use the Java ver 3.6.0 ``` +**If Container image build (Jib) selected**: +```xml +3.5.1 +``` + The final `` section will look like this (example with common selections): ```xml @@ -382,6 +398,7 @@ The final `` section will look like this (example with common select 4.9.3.0 3.13.0 + 80 @@ -2099,11 +2116,86 @@ After adding this profile, verify the configuration: - **MUST** use properties configured in Step 4 for plugin versions - **MUST** skip this step entirely if Cyclomatic Complexity was not selected +### Step 21: Jib Maven Plugin Configuration + +**Purpose**: Configure Jib Maven plugin for building container images without Docker daemon, using the image name provided in Step 3.1. + +**Dependencies**: Only execute if user selected "Container image build (Jib)" in Step 3. Requires completion of core plugin steps (3, 4, 5). + +**CRITICAL PRESERVATION RULE**: Only ADD this plugin if it doesn't already exist. Never REPLACE or REMOVE existing plugins. + +## Pre-Implementation Check + +**BEFORE adding Jib plugin, check if it already exists in the pom.xml:** + +If jib-maven-plugin already exists: Ask user "Jib plugin already exists. Do you want to enhance the existing configuration? (y/n)" + +If user says "n": Skip this step entirely. +If user says "y": Proceed with adding missing configuration elements only. + +**CONDITIONAL EXECUTION**: Only execute this step if user selected "Container image build (Jib)" in Step 3. + +## Implementation Guidelines + +1. **Replace image placeholder**: Use the target container image from Question 3.1 (e.g., `gcr.io/my-project/my-app`, `docker.io/username/myimage`, or `myimage` for local Docker) +2. **No Docker daemon required**: Jib builds images directly; useful for CI/CD and local development + +## Jib Plugin Configuration + +**ADD this plugin to the `` section ONLY if it doesn't already exist:** + +```xml + + com.google.cloud.tools + jib-maven-plugin + ${maven-plugin-jib.version} + + + REPLACE_WITH_ACTUAL_IMAGE + + + +``` + +**Replace `REPLACE_WITH_ACTUAL_IMAGE`** with the value from Question 3.1 (e.g., `myimage`, `gcr.io/my-project/my-app`). + +## Usage Examples + +```bash +# Build container image (no Docker daemon required) +./mvnw compile jib:build + +# Build to Docker daemon (for local testing) +./mvnw compile jib:dockerBuild + +# Build image tarball +./mvnw compile jib:buildTar +``` + +## Validation + +After adding this plugin, verify the configuration: + +```bash +# Validate plugin configuration +./mvnw validate +``` + + +#### Step Constraints + +- **MUST** only add Jib plugin if "Container image build (Jib)" was selected in Step 3 +- **MUST** check if plugin already exists before adding +- **MUST** ask user permission before modifying existing plugin configuration +- **MUST** use properties configured in Step 4 for plugin version +- **MUST** replace REPLACE_WITH_ACTUAL_IMAGE with the target container image from Question 3.1 +- **MUST** skip this step entirely if Container image build (Jib) was not selected + ## Output Format - Ask questions one by one following the template exactly in Step 3 -- Execute steps 4-20 only based on user selections from Step 3 +- Execute steps 4-21 only based on user selections from Step 3 - Skip entire steps if no relevant features were selected - Implement only requested features based on user selections - Follow template specifications exactly for all configurations diff --git a/system-prompts-generator/src/main/resources/system-prompts/112-java-maven-plugins.xml b/system-prompts-generator/src/main/resources/system-prompts/112-java-maven-plugins.xml index 316dac2a..14f96812 100644 --- a/system-prompts-generator/src/main/resources/system-prompts/112-java-maven-plugins.xml +++ b/system-prompts-generator/src/main/resources/system-prompts/112-java-maven-plugins.xml @@ -110,9 +110,10 @@ **MUST NOT** ask all questions simultaneously **MUST NOT** assume answers or provide defaults **MUST NOT** skip questions or change their order - **MUST** follow question sequence: Project Nature → Java Version → Build and Quality Aspects → Coverage Threshold (conditional) → Sonar Configuration (conditional) → Sonar Host Configuration (conditional) + **MUST** follow question sequence: Project Nature → Java Version → Build and Quality Aspects → Jib Image (conditional) → Coverage Threshold (conditional) → Sonar Configuration (conditional) → Sonar Host Configuration (conditional) **MUST** confirm understanding of user selections before proceeding to Step 4 **MUST NOT** ask about Coverage Threshold if user did not select jacoco coverage + **MUST** ask Question 3.1 (target container image) if "Container image build (Jib)" was selected in Question 3 @@ -1886,12 +1887,90 @@ After adding this profile, verify the configuration: + + Jib Maven Plugin Configuration + ` section ONLY if it doesn't already exist:** + +```xml + + com.google.cloud.tools + jib-maven-plugin + ${maven-plugin-jib.version} + + + REPLACE_WITH_ACTUAL_IMAGE + + + +``` + +**Replace `REPLACE_WITH_ACTUAL_IMAGE`** with the value from Question 3.1 (e.g., `myimage`, `gcr.io/my-project/my-app`). + +## Usage Examples + +```bash +# Build container image (no Docker daemon required) +./mvnw compile jib:build + +# Build to Docker daemon (for local testing) +./mvnw compile jib:dockerBuild + +# Build image tarball +./mvnw compile jib:buildTar +``` + +## Validation + +After adding this plugin, verify the configuration: + +```bash +# Validate plugin configuration +./mvnw validate +``` + ]]> + + + + **MUST** only add Jib plugin if "Container image build (Jib)" was selected in Step 3 + **MUST** check if plugin already exists before adding + **MUST** ask user permission before modifying existing plugin configuration + **MUST** use properties configured in Step 4 for plugin version + **MUST** replace REPLACE_WITH_ACTUAL_IMAGE with the target container image from Question 3.1 + **MUST** skip this step entirely if Container image build (Jib) was not selected + + + Ask questions one by one following the template exactly in Step 3 - Execute steps 4-20 only based on user selections from Step 3 + Execute steps 4-21 only based on user selections from Step 3 Skip entire steps if no relevant features were selected Implement only requested features based on user selections Follow template specifications exactly for all configurations diff --git a/system-prompts-generator/src/main/resources/system-prompts/assets/java-maven-properties-template.md b/system-prompts-generator/src/main/resources/system-prompts/assets/java-maven-properties-template.md index fcb12b68..f895b6c9 100644 --- a/system-prompts-generator/src/main/resources/system-prompts/assets/java-maven-properties-template.md +++ b/system-prompts-generator/src/main/resources/system-prompts/assets/java-maven-properties-template.md @@ -143,6 +143,11 @@ Start with essential build properties that every project needs (use the Java ver 3.6.0 ``` +**If Container image build (Jib) selected**: +```xml +3.5.1 +``` + The final `` section will look like this (example with common selections): ```xml @@ -164,6 +169,7 @@ The final `` section will look like this (example with common select 4.9.3.0 3.13.0 + 80 diff --git a/system-prompts-generator/src/main/resources/system-prompts/assets/questions/java-maven-plugins-questions-template.md b/system-prompts-generator/src/main/resources/system-prompts/assets/questions/java-maven-plugins-questions-template.md index 486f06da..86f6f414 100644 --- a/system-prompts-generator/src/main/resources/system-prompts/assets/questions/java-maven-plugins-questions-template.md +++ b/system-prompts-generator/src/main/resources/system-prompts/assets/questions/java-maven-plugins-questions-template.md @@ -35,6 +35,7 @@ Options: - Security static code analysis (SpotBugs, PMD) - Sonar - Version management +- Container image build (Jib) - JMH (Java Microbenchmark Harness) - Maven Compiler - Cyclomatic Complexity @@ -43,6 +44,15 @@ Options: --- +**Question 3.1** (conditional): What is your target container image for Jib? + +**Note**: This question is only asked if "Container image build (Jib)" was selected in question 3. + +- Example format: `gcr.io/my-project/my-app`, `docker.io/username/myimage`, or `myimage` for local Docker +- The image name will be used in the Jib plugin `` configuration + +--- + **Question 4**: What is your target coverage threshold? Options: