diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml deleted file mode 100644 index 5a936d4..0000000 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ /dev/null @@ -1,54 +0,0 @@ -name: Bug report 🐞 -description: File a bug report -title: "[Bug] " -labels: bug -body: - - type: input - id: existing-issue - attributes: - label: Is there an existing issue for this? - description: Please provide a link to the existing issue if applicable. If none exists, leave this blank. - placeholder: "Paste the issue link here (if available)" - - type: textarea - id: what-happened - attributes: - label: Describe the Bug - description: A concise description of what you are experiencing. - placeholder: Tell us what you see! - validations: - required: true - - type: textarea - id: expected-behaviour - attributes: - label: Expected Behavior - description: A clear and concise description of what you expected to happen. - validations: - required: true - - type: textarea - id: reproduction-steps - attributes: - label: Steps to Reproduce & Screenshots πŸ“Έ - description: | - Please list the steps to reproduce this issue along with relevant screenshots. - This helps us diagnose and resolve the bug more efficiently. - placeholder: | - 1. Go to '...' - 2. Click on '...' - 3. Scroll down to '...' - 4. See error message... - - (Attach screenshots or GIFs below to demonstrate the issue) - - type: textarea - id: environment-configuration - attributes: - label: Environment and Configuration - description: Provide details about your system and environment (e.g., OS, browser, dependencies, versions). - - type: checkboxes - id: terms - attributes: - label: Record - options: - - label: "I have read the Contributing Guidelines" - required: true - - label: "I have starred the repository" - required: true diff --git a/.github/ISSUE_TEMPLATE/documentation_update.yaml b/.github/ISSUE_TEMPLATE/documentation_update.yaml deleted file mode 100644 index c49c594..0000000 --- a/.github/ISSUE_TEMPLATE/documentation_update.yaml +++ /dev/null @@ -1,57 +0,0 @@ -name: Documentation Update πŸ“ - -description: Improve Documentation -title: "[Documentation Update]: " -labels: 'documentation' -body: - - type: input - id: existing-issue-link - attributes: - label: Link to Existing Issue - description: If an issue already exists for this update, please provide the link. Otherwise, leave it blank. - placeholder: "https://github.com/owner/repository/issues/123" - - type: textarea - id: issue-description - attributes: - label: Issue Description - description: Please provide a clear description of the documentation update you are suggesting. - placeholder: Describe the improvement or correction you'd like to see in the documentation. - validations: - required: true - - type: textarea - id: suggested-change - attributes: - label: Suggested Change - description: Provide details of the proposed change to the documentation. - placeholder: Explain how the documentation should be updated or corrected. - validations: - required: true - - type: textarea - id: rationale - attributes: - label: Rationale - description: Why is this documentation update necessary or beneficial? - placeholder: Explain the importance or reasoning behind the suggested change. - validations: - required: false - - type: dropdown - id: urgency - attributes: - label: Urgency - description: How urgently do you believe this documentation update is needed? - options: - - High - - Medium - - Low - default: 0 - validations: - required: true - - type: checkboxes - id: terms - attributes: - label: Record - options: - - label: "I have read the Contributing Guidelines" - required: true - - label: "I have starred the repository" - required: false # Made optional so users are not forced to star the repo diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml deleted file mode 100644 index 0cd3e58..0000000 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ /dev/null @@ -1,59 +0,0 @@ -name: Feature Request ✨ -description: Suggest a feature -title: "[Feature Request] " -labels: enhancement -body: - - type: input - id: existing-issue - attributes: - label: Is there an existing issue for this? - description: "If there is an existing issue related to this feature request, please provide the link. Otherwise, you may leave this blank." - placeholder: "https://github.com/owner/repository/issues/123" - - type: textarea - id: feature-description - attributes: - label: Feature Description - description: Please provide a detailed description of the feature you are requesting. - placeholder: Describe the new feature or enhancement you'd like to see. - validations: - required: true - - type: textarea - id: use-case - attributes: - label: Use Case - description: How would this feature enhance your use of the project? - placeholder: Describe a specific use case or scenario where this feature would be beneficial. - validations: - required: true - - type: textarea - id: benefits - attributes: - label: Benefits - description: What benefits would this feature bring to the project or community? - placeholder: Explain the advantages of implementing this feature. - - type: textarea - id: screenshots - attributes: - label: Add Screenshots - description: If applicable, add screenshots or visual references. - - type: dropdown - id: priority - attributes: - label: Priority - description: How important is this feature to you? - options: - - High - - Medium - - Low - default: 0 - validations: - required: true - - type: checkboxes - id: terms - attributes: - label: Record - options: - - label: "I have read the Contributing Guidelines" - required: true - - label: "I have starred the repository" - required: false # Made optional so users are not forced to star the repo diff --git a/.github/ISSUE_TEMPLATE/other.yaml b/.github/ISSUE_TEMPLATE/other.yaml deleted file mode 100644 index 579cbf4..0000000 --- a/.github/ISSUE_TEMPLATE/other.yaml +++ /dev/null @@ -1,25 +0,0 @@ -name: Other -description: Use this for any other issues. Please do NOT create blank issues -title: '[OTHER] write a small description here' -body: - - type: textarea - id: issuedescription - attributes: - label: What would you like to share? - description: Provide a clear and concise explanation of your issue. - validations: - required: true - - - type: checkboxes - id: no-duplicate-issues - attributes: - label: 'Checklist πŸš€' - options: - - label: "I checked and didn't find a similar issue" - required: true - - - label: 'I have read the Contributing Guidelines' - required: true - - - label: 'I am willing to work on this issue (blank for no).' - required: false diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml deleted file mode 100644 index 5400e14..0000000 --- a/.github/workflows/github-pages.yml +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright 2023-2023 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# -# This is a basic workflow to help you get started with Actions - -name: Github Pages - -# Controls when the workflow will run -on: -# Triggers the workflow on push or pull request events but only for the main branch -# push: -# branches: [ main ] - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - inputs: - tag: - required: true - type: string - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - # This workflow contains a single job called "build" - "Build-And-Publish-GitHub-Pages": - # The type of runner that the job will run on - runs-on: ubuntu-latest - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - name: Checkout sources from TAG poc-maven-plugin-${{ inputs.tag }} - uses: actions/checkout@v3 - with: - fetch-depth: 0 - ref: ${{ inputs.tag }} - - - name: Set up JDK 11 - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: 11 - cache: maven - - - name: Build site - run: mvn clean verify site -B - - - name: Generated assets - run: | - tree ./target/site - - - - name: Deploy to GitHub Pages - if: success() - uses: crazy-max/ghaction-github-pages@v3 - with: - target_branch: gh-pages - build_dir: target/site - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/java-11.yml b/.github/workflows/java-11.yml deleted file mode 100644 index 311f5a7..0000000 --- a/.github/workflows/java-11.yml +++ /dev/null @@ -1,98 +0,0 @@ -# Copyright 2023-2023 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# - -name: Java 11 CI with Maven - -on: - push: - branches: [ main ] - # Each pull request is important to us, doesn't matter from which branch. - # Furthermore, we do not want to build on just the default GitHub Action - # events, we also want to react onto `labeled` events for our extended - # build execution - pull_request: - types: [ labeled, opened, synchronize, reopened ] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Set up JDK 11 - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: 11 - cache: maven - - - name: Build with Maven - run: mvn -B verify -P run-its - - - name: Generate JaCoCo badge - id: jacoco - uses: cicirello/jacoco-badge-generator@v2.11.0 - with: - badges-directory: .github/badges - generate-branches-badge: true - generate-summary: true - summary-filename: coverage-summary_java-11.json - coverage-badge-filename: jacoco_java-11.svg - branches-badge-filename: branches_java-11.svg - coverage-endpoint-filename: jacoco_java-11.json - branches-endpoint-filename: branches_java-11.json - - - name: Log coverage percentages to workflow output - run: | - echo "(java-11) coverage = ${{ steps.jacoco.outputs.coverage }}%" - echo "(java-11) branches = ${{ steps.jacoco.outputs.branches }}%" - - - name: Upload JaCoCo coverage report - uses: actions/upload-artifact@v4 - with: - name: jacoco-report-java-11 - path: target/site/jacoco/ - - - name: Deploy to Coverage Branch - if: ${{ github.event_name != 'pull_request' }} - uses: crazy-max/ghaction-github-pages@v4 - with: - target_branch: coverage - build_dir: .github/badges - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Comment on PR with coverage percentages - if: ${{ github.event_name == 'pull_request' }} - run: | - REPORT=$(<.github/badges/coverage-summary_java-11.json) - if [[ -z "$REPORT" ]]; then - echo "Coverage report not found!" >&2 - exit 1 - fi - - COVERAGE=$(jq -r '.coverage' <<< "$REPORT")% - BRANCHES=$(jq -r '.branches' <<< "$REPORT")% - NEWLINE=$'\n' - BODY="## JaCoCo Test Coverage Summary Statistics (Java 11) ${NEWLINE}* __Coverage:__ ${COVERAGE}${NEWLINE}* __Branches:__ ${BRANCHES}" - - gh pr comment ${{ github.event.pull_request.number }} -b "${BODY}" - continue-on-error: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/java-17.yml b/.github/workflows/java-17.yml deleted file mode 100644 index d83bcf6..0000000 --- a/.github/workflows/java-17.yml +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright 2023-2023 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# - -name: Java 17 CI with Maven - -on: - push: - branches: [ main ] - pull_request: - types: [ labeled, opened, synchronize, reopened ] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: 17 - cache: maven - - - name: Build with Maven - run: mvn -B verify -P java-17,run-its - - - name: Generate JaCoCo badge - id: jacoco - uses: cicirello/jacoco-badge-generator@v2.11.0 - with: - badges-directory: .github/badges - generate-branches-badge: true - generate-summary: true - summary-filename: coverage-summary_java-17.json - coverage-badge-filename: jacoco_java-17.svg - branches-badge-filename: branches_java-17.svg - coverage-endpoint-filename: jacoco_java-17.json - branches-endpoint-filename: branches_java-17.json - - - name: Log coverage percentages to workflow output - run: | - echo "(java-17) coverage = ${{ steps.jacoco.outputs.coverage }}%" - echo "(java-17) branches = ${{ steps.jacoco.outputs.branches }}%" - - - name: Upload JaCoCo coverage report - uses: actions/upload-artifact@v4 - with: - name: jacoco-report-java-17 - path: target/site/jacoco/ - - - name: Deploy to Coverage Branch - if: ${{ github.event_name != 'pull_request' }} - uses: crazy-max/ghaction-github-pages@v4 - with: - target_branch: coverage - build_dir: .github/badges - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Comment on PR with coverage percentages - if: ${{ github.event_name == 'pull_request' }} - run: | - REPORT=$(<.github/badges/coverage-summary_java-17.json) - COVERAGE=$(jq -r '.coverage' <<< "$REPORT")% - BRANCHES=$(jq -r '.branches' <<< "$REPORT")% - NEWLINE=$'\n' - BODY="## JaCoCo Test Coverage Summary Statistics (java-17) ${NEWLINE}* __Coverage:__ ${COVERAGE}${NEWLINE}* __Branches:__ ${BRANCHES}" - gh pr comment ${{github.event.pull_request.number}} -b "${BODY}" - continue-on-error: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/java-21.yml b/.github/workflows/java-21.yml deleted file mode 100644 index 19f360a..0000000 --- a/.github/workflows/java-21.yml +++ /dev/null @@ -1,71 +0,0 @@ -# Java 21 CI with Maven -name: Java 21 CI with Maven - -on: - push: - branches: [ main ] - pull_request: - types: [ labeled, opened, synchronize, reopened ] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Set up JDK 21 - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: 21 - cache: maven - - - name: Build with Maven - run: mvn -B verify -P run-its - - - name: Generate JaCoCo badge - id: jacoco - uses: cicirello/jacoco-badge-generator@v2.11.0 - with: - badges-directory: .github/badges - generate-branches-badge: true - generate-summary: true - summary-filename: coverage-summary_java-21.json - coverage-badge-filename: jacoco_java-21.svg - branches-badge-filename: branches_java-21.svg - coverage-endpoint-filename: jacoco_java-21.json - branches-endpoint-filename: branches_java-21.json - - - name: Log coverage percentages to workflow output - run: | - echo "(java-21) coverage = ${{ steps.jacoco.outputs.coverage }}%" - echo "(java-21) branches = ${{ steps.jacoco.outputs.branches }}%" - - - name: Upload JaCoCo coverage report - uses: actions/upload-artifact@v4 - with: - name: jacoco-report-java-21 - path: target/site/jacoco/ - - - name: Deploy to Coverage Branch - if: ${{ github.event_name != 'pull_request' }} - uses: crazy-max/ghaction-github-pages@v4 - with: - target_branch: coverage - build_dir: .github/badges - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Comment on PR with coverage percentages - if: ${{ github.event_name == 'pull_request' }} - run: | - REPORT=$(<.github/badges/coverage-summary_java-21.json) - COVERAGE=$(jq -r '.coverage' <<< "$REPORT")% - BRANCHES=$(jq -r '.branches' <<< "$REPORT")% - NEWLINE=$'\n' - BODY="## JaCoCo Test Coverage Summary Statistics (java-21) ${NEWLINE}* __Coverage:__ ${COVERAGE}${NEWLINE}* __Branches:__ ${BRANCHES}" - gh pr comment ${{github.event.pull_request.number}} -b "${BODY}" - continue-on-error: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-snapshot.yml b/.github/workflows/release-snapshot.yml deleted file mode 100644 index 63be667..0000000 --- a/.github/workflows/release-snapshot.yml +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright 2023-2023 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# - -# Publishing snapshot packages to the Maven Central Repository - -name: publish-snapshot-to-maven-central - -on: - workflow_dispatch: - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Set up JDK 11 - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: 11 - cache: maven - server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml - server-username: MAVEN_USERNAME # env variable for username in deploy - server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy - gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import - gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase - - - name: Build with Maven and Deploy SNAPSHOT - run: mvn -B clean deploy -P release - env: - MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} - MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} - MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index db0485b..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright 2023-2023 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# -# Publishing stable packages to the Maven Central Repository -name: publish-packages-to-maven-central - -on: - workflow_dispatch: - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Set up JDK 11 - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: 11 - cache: maven - server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml - server-username: MAVEN_USERNAME # env variable for username in deploy - server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy - gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import - gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase - - - name: Setting up git config - run: | - git config --global user.name "GitHub" - git config --global user.email "noreply@github.com" - - - name: Build with Maven and Deploy To Maven Central Repository - run: mvn -B release:prepare release:perform -P release - env: - MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} - MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} - MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} - diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 64b14b9..0000000 --- a/.gitignore +++ /dev/null @@ -1,329 +0,0 @@ -# Created by https://www.toptal.com/developers/gitignore/api/maven,intellij,intellij+iml,intellij+all,netbeans,eclipse -# Edit at https://www.toptal.com/developers/gitignore?templates=maven,intellij,intellij+iml,intellij+all,netbeans,eclipse - -### Eclipse ### -.metadata -bin/ -tmp/ -*.tmp -*.bak -*.swp -*~.nib -local.properties -.settings/ -.loadpath -.recommenders - -# External tool builders -.externalToolBuilders/ - -# Locally stored "Eclipse launch configurations" -*.launch - -# PyDev specific (Python IDE for Eclipse) -*.pydevproject - -# CDT-specific (C/C++ Development Tooling) -.cproject - -# CDT- autotools -.autotools - -# Java annotation processor (APT) -.factorypath - -# PDT-specific (PHP Development Tools) -.buildpath - -# sbteclipse plugin -.target - -# Tern plugin -.tern-project - -# TeXlipse plugin -.texlipse - -# STS (Spring Tool Suite) -.springBeans - -# Code Recommenders -.recommenders/ - -# Annotation Processing -.apt_generated/ -.apt_generated_test/ - -# Scala IDE specific (Scala & Java development for Eclipse) -.cache-main -.scala_dependencies -.worksheet - -# Uncomment this line if you wish to ignore the project description file. -# Typically, this file would be tracked if it contains build/dependency configurations: -#.project - -### Eclipse Patch ### -# Spring Boot Tooling -.sts4-cache/ - -### Intellij ### -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf - -# AWS User-specific -.idea/**/aws.xml - -# Generated files -.idea/**/contentModel.xml - -# Sensitive or high-churn files -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml - -# Gradle -.idea/**/gradle.xml -.idea/**/libraries - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/artifacts -# .idea/compiler.xml -# .idea/jarRepositories.xml -# .idea/modules.xml -# .idea/*.iml -# .idea/modules -# *.iml -# *.ipr - -# CMake -cmake-build-*/ - -# Mongo Explorer plugin -.idea/**/mongoSettings.xml - -# File-based project format -*.iws - -# IntelliJ -out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Cursive Clojure plugin -.idea/replstate.xml - -# SonarLint plugin -.idea/sonarlint/ - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties - -# Editor-based Rest Client -.idea/httpRequests - -# Android studio 3.1+ serialized cache file -.idea/caches/build_file_checksums.ser - -### Intellij Patch ### -# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 - -# *.iml -# modules.xml -# .idea/misc.xml -# *.ipr - -# Sonarlint plugin -# https://plugins.jetbrains.com/plugin/7973-sonarlint -.idea/**/sonarlint/ - -# SonarQube Plugin -# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin -.idea/**/sonarIssues.xml - -# Markdown Navigator plugin -# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced -.idea/**/markdown-navigator.xml -.idea/**/markdown-navigator-enh.xml -.idea/**/markdown-navigator/ - -# Cache file creation bug -# See https://youtrack.jetbrains.com/issue/JBR-2257 -.idea/$CACHE_FILE$ - -# CodeStream plugin -# https://plugins.jetbrains.com/plugin/12206-codestream -.idea/codestream.xml - -# Azure Toolkit for IntelliJ plugin -# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij -.idea/**/azureSettings.xml - -### Intellij+all ### -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff - -# AWS User-specific - -# Generated files - -# Sensitive or high-churn files - -# Gradle - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/artifacts -# .idea/compiler.xml -# .idea/jarRepositories.xml -# .idea/modules.xml -# .idea/*.iml -# .idea/modules -# *.iml -# *.ipr - -# CMake - -# Mongo Explorer plugin - -# File-based project format - -# IntelliJ - -# mpeltonen/sbt-idea plugin - -# JIRA plugin - -# Cursive Clojure plugin - -# SonarLint plugin - -# Crashlytics plugin (for Android Studio and IntelliJ) - -# Editor-based Rest Client - -# Android studio 3.1+ serialized cache file - -### Intellij+all Patch ### -# Ignore everything but code style settings and run configurations -# that are supposed to be shared within teams. - -.idea/* - -!.idea/codeStyles -!.idea/runConfigurations - -### Intellij+iml ### -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff - -# AWS User-specific - -# Generated files - -# Sensitive or high-churn files - -# Gradle - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/artifacts -# .idea/compiler.xml -# .idea/jarRepositories.xml -# .idea/modules.xml -# .idea/*.iml -# .idea/modules -# *.iml -# *.ipr - -# CMake - -# Mongo Explorer plugin - -# File-based project format - -# IntelliJ - -# mpeltonen/sbt-idea plugin - -# JIRA plugin - -# Cursive Clojure plugin - -# SonarLint plugin - -# Crashlytics plugin (for Android Studio and IntelliJ) - -# Editor-based Rest Client - -# Android studio 3.1+ serialized cache file - -### Intellij+iml Patch ### -# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 - -*.iml -modules.xml -.idea/misc.xml -*.ipr - -### Maven ### -target/ -pom.xml.tag -pom.xml.releaseBackup -pom.xml.versionsBackup -pom.xml.next -release.properties -dependency-reduced-pom.xml -buildNumber.properties -.mvn/timing.properties -# https://github.com/takari/maven-wrapper#usage-without-binary-jar -.mvn/wrapper/maven-wrapper.jar - -# Eclipse m2e generated files -# Eclipse Core -.project -# JDT-specific (Eclipse Java Development Tools) -.classpath - -### NetBeans ### -**/nbproject/private/ -**/nbproject/Makefile-*.mk -**/nbproject/Package-*.bash -build/ -nbbuild/ -dist/ -nbdist/ -.nb-gradle/ - -# End of https://www.toptal.com/developers/gitignore/api/maven,intellij,intellij+iml,intellij+all,netbeans,eclipse.teste/* - -.teste/ \ No newline at end of file diff --git a/.sdkmanrc b/.sdkmanrc deleted file mode 100644 index c6a70ba..0000000 --- a/.sdkmanrc +++ /dev/null @@ -1,3 +0,0 @@ -# Enable auto-env through the sdkman_auto_env config -# Add key=value pairs of SDKs to use below -java=11.0.23-tem diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc deleted file mode 100644 index 19d1ab5..0000000 --- a/CHANGELOG.adoc +++ /dev/null @@ -1,96 +0,0 @@ -= Changelog -:toc: auto - -All notable changes to this project will be documented in this file. - -The format is based on https://keepachangelog.com/en/1.0.0/[Keep a Changelog], -and this project adheres to https://semver.org/spec/v2.0.0.html[Semantic Versioning]. - -== [Unreleased] - -=== Added -- ? - -=== Changes -- ? - -=== Fixes -- ? - -== [1.0.0] - -=== Added -- Enhance integration tests for `commit` and `rollback` mojos; -- Added the `change-prop` mojo in order to be able to change a property value in the target POM; - -=== Changes -- Changed package structure: the model classes were moved to the `api` package; -- Changed package structure: the mojo classes were moved to the `mojo` package; -- Refactored classes to improve the maintainability; -- Refactored `add-dep` mojo to use new implementation; -- Refactored `commit` mojo to use new implementation; -- Refactored `rollback` mojo to use new implementation; -- Enhanced tests for `api` classes; -- Enhanced tests for `mojo` classes; -- Enhanced integration tests for `commit` and `rollback` mojos; -- Enhanced java-docs for `api` classes; - -=== Fixed - -== [1.0.0-SNAPSHOT] - -=== Added -- Enhance integration tests for `commit` and `rollback` mojos; -- Added the `change-prop` mojo in order to be able to change a property value in the target POM; - -=== Changes -- Changed package structure: the model classes were moved to the `api` package; -- Changed package structure: the mojo classes were moved to the `mojo` package; -- Refactored classes to improve the maintainability; -- Refactored `add-dep` mojo to use new implementation; -- Refactored `commit` mojo to use new implementation; -- Refactored `rollback` mojo to use new implementation; -- Enhanced tests for `api` classes; -- Enhanced tests for `mojo` classes; -- Enhanced integration tests for `commit` and `rollback` mojos; -- Enhanced java-docs for `api` classes; - - -== [0.0.3] - -=== Added -- Added CHANGELOG documentation; -- Added CONTRIBUTING guide; -- Added issues templates; - -=== Changes -- Updated README documentation; -- Moved project from ArrudaLabs to SouJava - - -== [0.0.3-SNAPSHOT] 2023-03-28T04:33:13Z - -=== Added -- Added CHANGELOG documentation; -- Added CONTRIBUTING guide; -- Added issues templates; - -=== Changes -- Updated README documentation; -- Moved project from ArrudaLabs to SouJava - -== [0.0.2] 2023-03-23T23:46:43Z - -=== Added -- Added the property called `gav` into the `add-dep` goal in order to inform the target dependency following the GAV(`groupId:artifactId:version`) pattern - -=== Removed -- Removed the properties: `groupId`, `artifactId`, `version` in favor to use the `gav` property - -== [0.0.1] - 2023-03-20T06:50:35Z - -=== Added - -- Added the `add-dep` maven goal in order to be able to add one dependency by time into a target POM -- Added the `commit` maven goal in order to be able to confirm the changes into the target POM, removing the backup POM file; -- Added the `rollback` maven goal in order to be able to revert the changes into the target POM; diff --git a/CODE_OF_CONDUCT.adoc b/CODE_OF_CONDUCT.adoc deleted file mode 100644 index 140d159..0000000 --- a/CODE_OF_CONDUCT.adoc +++ /dev/null @@ -1,49 +0,0 @@ -= Contributor Covenant Code of Conduct -:toc: auto - -== Our Pledge - -In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity, and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. - -== Our Standards - -Examples of behavior that contributes to creating a positive environment include: - -- Using welcoming and inclusive language -- Being respectful of differing viewpoints and experiences -- Gracefully accepting constructive criticism -- Focusing on what is best for the community -- Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -- The use of sexualized language or imagery and unwelcome sexual attention or advances -- Trolling, insulting/derogatory comments, and personal or political attacks -- Public or private harassment -- Publishing others' private information, such as a physical or electronic address, without explicit permission -- Other conduct which could reasonably be considered inappropriate in a professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. - -== Scope - -This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the project or its community in public spaces. -Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. - -== Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team leader at dearrudam@gmail.com. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. - -== Attribution - -This Code of Conduct is adapted from the link:https://www.contributor-covenant.org[**Contributor Covenant**], version 1.4, available at link:http://contributor-covenant.org/version/1/4[here]. - -For answers to common questions about this code of conduct, see link:https://www.contributor-covenant.org/faq[**the FAQ section**]. diff --git a/CONTRIBUTING.adoc b/CONTRIBUTING.adoc deleted file mode 100644 index 335fc0d..0000000 --- a/CONTRIBUTING.adoc +++ /dev/null @@ -1,172 +0,0 @@ -= Contributing to POM Editor Maven Plugin -:toc: auto - -We are very happy you are interested in helping us and there are plenty ways you can do so. Thanks for your interest in this project. - -== Contact - -Join the SouJava Discord server and say hello at `#pom-editor-maven-plugin` channel. - -* https://discord.gg/eAARnH7yrG - -== Legal - -This project is licensed over link:https://github.com/soujava/pom-editor-maven-plugin/blob/main/LICENSE[**ASF - Apache License**], version 2, so new files must have the ASF version 2 header. For more information, please check out link:https://www.apache.org/licenses/LICENSE-2.0[**Apache license**]; - -== Developer Certificate of Origin - DCO - -One of the requisites to contributing to this project is to add DCO to your commits. - -This is a security layer for the project and for the developers. It is mandatory. - -Follow one of these two methods to add DCO to your commits: - -=== Command line - -Follow the steps: - -- **Step 1:** Configure your local git environment adding the same name and e-mail configured at your GitHub account. It helps to sign commits manually during reviews and suggestions. - -[source, sh] ----- -git config --global user.name β€œName” -git config --global user.email β€œemail@domain.com.br” ----- - -- **Step 2:** Add the Signed-off-by line with the `-s` flag in the git commit command: - -[source, sh] ----- -$ git commit -s -m "This is my commit message" ----- -or -[source, sh] ----- -$ git commit -sm "This is my commit message" ----- - -=== GitHub website - -You can also manually sign your commits during GitHub reviews and suggestions, follow the steps below: - -1. **Step 1:** When the commit changes box opens, manually type or paste your signature in the comment box, see the example: - -[source, text] ----- -Signed-off-by: Name < e-mail address > ----- - -For this method, your name and e-mail must be the same registered on your GitHub account. - - -== Issues - -If you found a bug or have an idea, check out the following sections before submitting your contribution. - -=== Check the issue tracker - -All our issues are centralized in our https://github.com/arrudalabs/pom-editor-maven-plugin[**main repository**], it is quite likely that you will find a topic that is being discussed. Check the https://github.com/arrudalabs/pom-editor-maven-plugin/issues[**open issues**], another good way to start is https://github.com/arrudalabs/pom-editor-maven-plugin/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22[**good first issues**]. - -=== Open an issue for any new problem - -Writing a good issue will help our team better analyze and manage your contributions, therefore, follow the standards and best practices below: - -**With the title:** - -**Scope - Title Description** - -- **Scope:** Add what your issue refers to: - -- **https://github.com/arrudalabs/pom-editor-maven-plugin/issues/new?assignees=&labels=bug&template=bug_report.md&title=[Bug report]:** Report a reproducible bug. - -- **https://github.com/arrudalabs/pom-editor-maven-plugin/issues/new?assignees=&labels=&template=feature_request.md&title=[Feature request]:** Suggest a new idea for POM Editor Maven Plugin. - -> **Example: Feat request - Suggestion for a better user experience** - -**With the issue description:** - -Try to explain the scenario to us by following these tips: - -- **Context:** explain the conditions which led you to write this issue. -- **Problem or idea:** the context should lead to something, an idea or a problem that you’re facing. -- **Solution or next step:** this where you move forward. You can engage others (request feedback), assign somebody else to the issue, or simply leave it for further investigation, but you absolutely need to propose a next step towards solving the issue. - -== Contribute to the repo - -To contribute to the repo one must adhere to the following: - -**Conventional commits** - -Conventional commits is a specification to standardize -commit messages. It improves the legibility and the meaning -of the messages enforcing rules to be followed. - -The message should be formatted as shown bellow. - -[source] ----- -[optional scope]: - -[optional body] - -[optional footer(s)] ----- - - -**Types of Commits:** - -- **fix:** Any commit that patches a bug anywhere in the codebase -- **feat:** Any commit that introduces a new feature or focuses on enhancing the scope of existing features -- **breaking changes:** Any commit that has a footer "BREAKING CHANGE", or appends a ! after the type/scope, introduces a breaking API change (correlating with MAJOR in Semantic Versioning). A BREAKING CHANGE can be part of commits of any type. -- **other than fix and feat:** Any commit that consists of the following keywords: `build:`, `chore:`, `ci:`, `docs:`, `style:`, `refactor:`, `perf:`, `test:`, and others. For other keywords refer to https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional[@commitlint/config-conventional] (based on the Angular convention) -- **other footers:** may be provided and follow a convention similar to https://git-scm.com/docs/git-interpret-trailers[git trailer format] - -**Examples of commits** - -- **Regular Commit Message:** This may be used for either fix or feat and can be written as `fix: ` or `feat: ` - -[source] ----- -fix: add NullPointerException validation ----- - -[source] ----- -feat: supporting GAV parameter ----- -- **Commit with breaking change**: Example: A new feature being introduced as a breaking change can be written as `feat!: `, this can also simply be written as a regular feat with the *BREAKING CHANGE* appended to it at the end of the commit - -[source] ----- -feat!: replace flag ----- - -[source] ----- -feat: add new flag - -BREAKING CHANGE: used records, a feature that requires from Java 17 onwards ----- -- **Specific breaking change:**: Example: A breaking change introduced with a new feature somewhere in the api can be written as `feat(api)!: ` - -[source] ----- -feat(api)!: add a required flag ----- -- **Changing the docs:** `docs: ` - -[source] ----- -docs: add README.md ----- -- **Regular commit message with specification:** A new feature introduced in the api can be written as `feat(api): ` - -[source] ----- -feat(api): add support for pom parent ----- - -**Formatting Commit messages** - -All commit messages must clearly state the change that takes place. Multiple paragraphs or bullet points explaining the changes in detail are encouraged. The message must contain the link to the issue that it is directed towards. -If there are other people working on a particular issue which you wanted to work on as well, consider working together. If the commit influences a visual change, screenshots are encouraged \ No newline at end of file diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/README.adoc b/README.adoc deleted file mode 100644 index 1577a45..0000000 --- a/README.adoc +++ /dev/null @@ -1,173 +0,0 @@ - -= POM Editor Maven Plugin -:toc: auto - -image:https://img.shields.io/badge/1.0.0--SNAPTHOT-HTML%20--%20Plugin%20Documentation-blue[Documentation,link=https://soujava.github.io/pom-editor-maven-plugin/plugin-info.html, window=_blank, target=_blank] - -image:https://img.shields.io/maven-central/v/br.org.soujava/pom-editor-maven-plugin?style=flat-square[Maven Central, link=https://central.sonatype.com/search?smo=true&namespace=br.org.soujava&q=br.org.soujava, window=_blank, target=_blank] image:https://img.shields.io/maven-metadata/v?label=s01.oss.sonatype.org&metadataUrl=https%3A%2F%2Fs01.oss.sonatype.org%2Fcontent%2Frepositories%2Fsnapshots%2Fbr%2Forg%2Fsoujava%2Fpom-editor-maven-plugin%2Fmaven-metadata.xml&style=flat-square[Maven SNAPSHOT Repo,link=https://bit.ly/3oxRi0X, window=_blank, target=_blank] - -image:https://github.com/soujava/pom-editor-maven-plugin/actions/workflows/java-11.yml/badge.svg[ link=https://github.com/soujava/pom-editor-maven-plugin/actions/workflows/java-11.yml, window=_blank, target=_blank] image:https://github.com/soujava/pom-editor-maven-plugin/actions/workflows/java-17.yml/badge.svg[ link=https://github.com/soujava/pom-editor-maven-plugin/actions/workflows/java-17.yml, window=_blank, target=_blank] image:https://github.com/soujava/pom-editor-maven-plugin/actions/workflows/java-21.yml/badge.svg[ link=https://github.com/soujava/pom-editor-maven-plugin/actions/workflows/java-21.yml, window=_blank, target=_blank] - -image:https://github.com/soujava/pom-editor-maven-plugin/blob/coverage/jacoco_java-17.svg[ link=https://soujava.github.io/pom-editor-maven-plugin/jacoco/index.html, window=_blank, target=_blank] image:https://github.com/soujava/pom-editor-maven-plugin/blob/coverage/branches_java-17.svg[ link=https://soujava.github.io/pom-editor-maven-plugin/jacoco/index.html, window=_blank, target=_blank] - -== Introduction - -Facilitate manipulation such as managing POM dependencies through CLI (command line interface) - -== How to use it - -[TIP] -=============================== -In order to make easier the plugin utilization we can register the groupId into the `settings.xml` like the snipped code below: -[source,xml] ----- - - - - br.org.soujava - - - ----- -With that, we will be able to perform the plugin by using its prefix. -So, instead of to perform the plugin by the following command: -[source, sh] ----- -mvn br.org.soujava:pom-editor-maven-plugin: ----- -We may perform it just providing its prefix like below: -[source, sh] ----- -mvn pom-editor: ----- -In the documentation, we'll assume that you have done this configuration. -=============================== - -=== Add/Change a dependency - -Let's suppose that you need to add JUnit Jupiter version 5.9.2 into your POM in the test scope, you could perform the following command inside on the target maven project: - -[source, sh] ----- -mvn pom-editor:add-dep -Dgav='org.junit.jupiter:junit-jupiter:5.9.2' -Dscope=test ----- - -.add-dep supported parameters -[cols="add-dep params"] -|=== -|Parameter | Description | Required | Default - -| gav -| Dependency coordinates. Supported format: `groupId:artifactId:version` -| Yes -| - -| pom -| Target POM file. -| No -| pom.xml - -| scope -| The scope of the dependency - compile, runtime, test, system, and provided -| No -| - -| type -| The type of dependency, that will be mapped to a file extension, an optional classifier and a few other attributes -| No -| - -| classifier -| The classifier of the dependency. It is appended to the filename after the version. -| No -| - -|=== - -=== Add/Change/Remove a property - -Let's suppose that you need to add a property to your pom file. - -[source, sh] ----- -mvn pom-editor:change-prop -Dproperty='custom-property' -Dvalue='Caesar' ----- - -.change-prop supported parameters -[cols="change-prop params"] -|=== -|Parameter | Description | Required | Default - -| pom -| Target POM file. -| No -| pom.xml - -| property -| The name of the property -| Yes -| - -| value -| The value of the property, if not specified, the request is to delete the property if it exists. -| No -| - -|=== - -=== Confirm the changes - -When you perform the goal add-dep with the command below: - -[source,sh] -$ mvn pom-editor:add-dep -Dgav='junit:junit:4.13' - -The plugin will create a backup POM file based on the target POM if such one doesn't exist. - -[source,sh] -$ tree . -. -β”œβ”€β”€ pom.xml -└── pom.xml.backup - -You could perform multiple times the add-dep goal as you need. - -Then, when you're done, if there's no problem with the changed POM, you could confirm the changes by performing the commit goal. - -[source,sh] -$ mvn pom-editor:commit - -=== Revert the changes - -You could also perform the rollback goal: - -[source,sh] -$ mvn pom-editor:rollback - -This goal will revert the changes, replacing the changed POM file to the backup POM file. - -== Goals - -It covers the following goals: - -* Add/Change dependencies at POM.xml -* Rollback/Commit changes at POM.xml - -== Code of Conduct - -Take a look at link:CODE_OF_CONDUCT.adoc[here] for more information. - -The Code of Conduct of this project is adapted from the link:https://www.contributor-covenant.org[**Contributor Covenant**], version 1.4, available at link:http://contributor-covenant.org/version/1/4[here]. - - -== Contributing - -We are very happy you are interested in helping us and there are plenty ways you can do so. - -- https://github.com/soujava/pom-editor-maven-plugin/issues[**Open an Issue:**] Recommend improvements, changes and report bugs - -- **Open a Pull Request:** If you feel like you can even make changes to our source code and suggest them, just check out our link:CONTRIBUTING.adoc[contributing guide] to learn about the development process, how to suggest bugfixes and improvements. - -== Contact - -Join the link:https://discord.gg/eAARnH7yrG[SouJava Discord server] and say hello at `#pom-editor-maven-plugin` channel! diff --git a/branches_java-21.svg b/branches_java-21.svg new file mode 100644 index 0000000..b53e2ea --- /dev/null +++ b/branches_java-21.svg @@ -0,0 +1 @@ +branches34.8% \ No newline at end of file diff --git a/coverage-summary_java-21.json b/coverage-summary_java-21.json new file mode 100644 index 0000000..9d4d200 --- /dev/null +++ b/coverage-summary_java-21.json @@ -0,0 +1 @@ +{"branches": 34.883720930232556, "coverage": 61.04477611940299} \ No newline at end of file diff --git a/jacoco_java-21.svg b/jacoco_java-21.svg new file mode 100644 index 0000000..020bf6c --- /dev/null +++ b/jacoco_java-21.svg @@ -0,0 +1 @@ +coverage61% \ No newline at end of file diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 97ad36d..0000000 --- a/pom.xml +++ /dev/null @@ -1,766 +0,0 @@ - - - - 4.0.0 - - br.org.soujava - pom-editor-maven-plugin - 1.1.0-SNAPSHOT - maven-plugin - - - SouJava - https://soujava.org.br - - - - scm:git:${project.scm.url} - scm:git:${project.scm.url} - https://github.com/soujava/pom-editor-maven-plugin.git - HEAD - - - - - Maximillian Arruda - dearrudam@gmail.com - - - - POM Editor Maven Plugin - It's a Maven Plugin to allowing POM editions - - https://soujava.github.io/pom-editor-maven-plugin - - - - Apache License, Version 2.0 - https://www.apache.org/licenses/LICENSE-2.0 - - - - - ${maven.version} - - - - **/HelpMojo.java - UTF-8 - UTF-8 - 11 - 11 - 11 - 3.8.1 - - 5.9.1 - 0.8.9 - ${basedir} - ${basedir}/target/ - - 3.6.4 - 4.11.0 - 3.3.2 - 3.2.1 - 3.2.0 - 3.8.1 - 3.3.0.603 - 0.12.0 - 0.12.0 - 5.9.1 - - - - - - org.apache.maven - maven-plugin-api - ${maven.version} - - - org.apache.maven - maven-core - ${maven.version} - - - org.apache.maven - maven-artifact - ${maven.version} - - - org.apache.maven - maven-compat - ${maven.version} - - - org.apache.maven.plugin-tools - maven-plugin-annotations - ${maven-plugin-annotations.version} - - - org.mockito - mockito-junit-jupiter - ${mockito-junit-jupiter.version} - - - com.soebes.itf.jupiter.extension - itf-assertj - ${itf-assertj.version} - - - org.junit.jupiter - junit-jupiter - ${junit-jupiter-engine.version} - - - com.soebes.itf.jupiter.extension - itf-jupiter-extension - ${itf-jupiter-extension.version} - - - - - org.l2x6.pom-tuner - pom-tuner - 4.2.0 - - - - - - - org.l2x6.pom-tuner - pom-tuner - - - org.apache.maven - maven-plugin-api - provided - - - org.apache.maven - maven-core - provided - - - org.apache.maven - maven-artifact - provided - - - org.apache.maven - maven-compat - test - - - org.apache.maven.plugin-tools - maven-plugin-annotations - provided - - - org.mockito - mockito-junit-jupiter - test - - - com.soebes.itf.jupiter.extension - itf-assertj - test - - - org.junit.jupiter - junit-jupiter - test - - - com.soebes.itf.jupiter.extension - itf-jupiter-extension - test - - - - - - - src/test/resources - false - - - src/test/resources-its - true - - - - - - - maven-clean-plugin - 3.2.0 - - - - maven-resources-plugin - 3.3.0 - - - maven-compiler-plugin - ${maven.compile.version} - - - maven-plugin-plugin - 3.6.4 - - - org.apache.maven.plugins - maven-plugin-report-plugin - 3.7.1 - - - maven-javadoc-plugin - ${maven-javadoc-plugin.vesion} - - - maven-source-plugin - ${maven-source-plugin.version} - - - maven-surefire-plugin - 2.22.1 - - - maven-jar-plugin - 3.0.2 - - - maven-install-plugin - 2.5.2 - - - maven-deploy-plugin - 2.8.2 - - - maven-invoker-plugin - 3.4.0 - - - maven-site-plugin - 3.11.0 - - - maven-enforcer-plugin - 3.0.0-M3 - - - org.apache.maven.plugins - maven-plugin-report-plugin - 3.7.1 - - - org.apache.maven.plugins - maven-checkstyle-plugin - ${maven.checkstyle.plugin.version} - - - org.sonarsource.scanner.maven - sonar-maven-plugin - ${sonar.maven.version} - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.7 - - - org.apache.maven.plugins - maven-gpg-plugin - 1.6 - - - org.apache.maven.plugins - maven-release-plugin - 3.0.0-M7 - - - org.jacoco - jacoco-maven-plugin - ${jacoco.maven.version} - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - - com.puppycrawl.tools - checkstyle - 10.3 - - - - - verify-style - process-classes - - check - - - - - **/module-info.java,${checkstyle.excludes} - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.apache.maven.plugins - maven-enforcer-plugin - - - true - - - - org.apache.rat - apache-rat-plugin - 0.13 - - - src/**/*.java - src/**/*.xml - pom.xml - - - - - rat-check - - check - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - ${maven.compiler.target} - ${maven.compiler.source} - - - - org.apache.maven.plugins - maven-jar-plugin - - - test-jar - - test-jar - - - - - - org.apache.maven.plugins - maven-plugin-plugin - - - true - - - - mojo-descriptor - - descriptor - - - - help-goal - - helpmojo - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - attach-javadocs - - jar - - - - - ${maven.compiler.source} - - - - maven-source-plugin - - - attach-sources - - jar-no-fork - - - - - - maven-invoker-plugin - 3.4.0 - - - org.jacoco - jacoco-maven-plugin - - - prepare-agent - - prepare-agent - - - - report - - report - - - - - - **/HelpMojo.class - - - HTML - CSV - XML - - - - - - - - - - org.apache.maven.plugins - maven-plugin-report-plugin - - - org.apache.maven.plugins - maven-plugin-plugin - - - - report - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - - javadoc - - - - - false - - - - org.jacoco - jacoco-maven-plugin - - - - report - - - - - - **/HelpMojo.class - - - - - - - - - - run-its - - - - org.jacoco - jacoco-maven-plugin - - - prepare-agent - - prepare-agent - - - - prepare-agent-integration-tests - - prepare-agent - - pre-integration-test - - - report - - report - - - - - - com.soebes.itf.jupiter.extension - itf-maven-plugin - 0.12.0 - - - installing - pre-integration-test - - install - resources-its - - - - - - maven-failsafe-plugin - 3.0.0-M7 - - - - ${maven.version} - ${maven.home} - - - - junit.jupiter.execution.parallel.enabled=true - junit.jupiter.execution.parallel.mode.default=concurrent - junit.jupiter.execution.parallel.mode.classes.default=same_thread - junit.jupiter.execution.parallel.config.strategy=fixed - junit.jupiter.execution.parallel.config.fixed.parallelism=6 - - - - - - - integration-test - verify - - - - - - - - - release - - - - org.sonatype.plugins - nexus-staging-maven-plugin - true - - ossrh - https://s01.oss.sonatype.org/ - true - - - - org.apache.maven.plugins - maven-release-plugin - - true - false - release - @{project.version} - deploy - - - - org.apache.maven.plugins - maven-gpg-plugin - - - sign-artifacts - verify - - sign - - - - --pinentry-mode - loopback - - - - - - - - - - java-17 - - 17 - 17 - 17 - - - - - - - ossrh - https://s01.oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ - - - - - oss.sonatype.org-snapshot - https://s01.oss.sonatype.org/content/repositories/snapshots - - false - - - true - - - - - \ No newline at end of file diff --git a/src/main/java/br/org/soujava/pomeditor/api/AddDependency.java b/src/main/java/br/org/soujava/pomeditor/api/AddDependency.java deleted file mode 100644 index 2ca91fb..0000000 --- a/src/main/java/br/org/soujava/pomeditor/api/AddDependency.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor.api; - -import org.l2x6.pom.tuner.PomTransformer; -import org.l2x6.pom.tuner.model.Gavtcs; - -import java.nio.charset.StandardCharsets; -import java.nio.file.Path; -import java.util.List; -import java.util.Optional; -import java.util.function.BiConsumer; -import java.util.stream.Collectors; - -/** - * Command responsible for adding a dependency to a given pom - */ -public interface AddDependency { - - - /** - * Add a dependency informed by the {@link Dependency} instance into the target POM xml - * - * @param pom it's the target POM xml - * @param dependency it's an {@link Dependency} instance - */ - static void execute(Path pom, Dependency dependency) { - new PomTransformer( - pom, - StandardCharsets.UTF_8, - PomTransformer.SimpleElementWhitespace.AUTODETECT_PREFER_SPACE) - .transform(addOrUpdateDependencyIfNeeded(dependency)); - } - - private static PomTransformer.Transformation addOrUpdateDependencyIfNeeded(Dependency dependencyToBeAdded) { - return (document, context) -> { - - Gavtcs dependency = toGavtcs(dependencyToBeAdded); - - List dependencies = context.getDependencies() - .stream() - .filter(nodeGavtcs -> nodeGavtcs.getGroupId().equals(dependency.getGroupId())) - .filter(nodeGavtcs -> nodeGavtcs.getArtifactId().equals(dependency.getArtifactId())) - .collect(Collectors.toList()); - - dependencies.stream().forEach( - nodeGavtcs -> { - - BiConsumer setValue = nodeChanger(nodeGavtcs); - setValue.accept("version", dependency.getVersion()); - setValue.accept("type", dependency.getType()); - setValue.accept("classifier", dependency.getClassifier()); - setValue.accept("scope", dependency.getScope()); - - }); - - if (dependencies.isEmpty()) { - context.addDependencyIfNeeded(dependency, Gavtcs.scopeAndTypeFirstComparator()); - } - }; - } - - private static Gavtcs toGavtcs(Dependency dependency) { - return new Gavtcs( - dependency.getGroupId(), - dependency.getArtifactId(), - dependency.getVersion(), - dependency.getType(), - dependency.getClassifier(), - dependency.getScope() - ); - } - - private static BiConsumer nodeChanger(PomTransformer.NodeGavtcs nodeGavtcs) { - final PomTransformer.ContainerElement node = nodeGavtcs.getNode(); - - return (name, value) -> { - Optional targetNode = node.childElementsStream() - .filter(ch -> name.equals(ch.getNode().getLocalName())) - .findFirst(); - if (!targetNode.isPresent() && value == null) { - /* nothing to do */ - } else if (!targetNode.isPresent()) { - node.addChildTextElement(name, value); - } else if (value == null) { - targetNode.get().remove(true, true); - } else { - targetNode.get().getNode().setTextContent(value); - } - }; - } -} diff --git a/src/main/java/br/org/soujava/pomeditor/api/ChangeProperty.java b/src/main/java/br/org/soujava/pomeditor/api/ChangeProperty.java deleted file mode 100644 index f5b2984..0000000 --- a/src/main/java/br/org/soujava/pomeditor/api/ChangeProperty.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2024 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor.api; - -import org.apache.maven.plugin.logging.Log; -import org.l2x6.pom.tuner.PomTransformer; - -import java.nio.charset.StandardCharsets; -import java.nio.file.Path; -import java.util.Optional; - -/** - * Command responsible for changing a property within a given pom - */ -public interface ChangeProperty { - - /** - * Change a property based on the {@link Property} instance into the target POM xml - * - * @param log it's the logger - * @param pom it's the target POM xml - * @param property it's a {@link Property} instance - */ - static void execute(Log log, Path pom, Property property) { - new PomTransformer( - pom, - StandardCharsets.UTF_8, - PomTransformer.SimpleElementWhitespace.AUTODETECT_PREFER_SPACE) - .transform(changePropertyIfNeeded(log, property)); - } - - private static PomTransformer.Transformation changePropertyIfNeeded(Log log, Property propertyToChange) { - return (document, context) -> { - - String name = propertyToChange.getName(); - String value = propertyToChange.getValue(); - boolean removing = value == null; - - log.debug("name: "+name); - log.debug("value: "+value); - log.debug("removing: "+removing); - - // the container API is a bit weird, we can't set a text value on a node, only on a sub-node. - - Optional propsWrap = context.getContainerElement("project", "properties"); - PomTransformer.ContainerElement props; - if (propsWrap.isEmpty()) { - log.debug("properties node not found"); - if (removing) { - log.debug("nothing to do, exiting"); - return; - } - props = context.getOrAddContainerElement("properties"); - log.debug("added properties:"+props); - } else { - props = propsWrap.get(); - log.debug("existing properties:"+props); - } - - Optional propWrap = props.getChildContainerElement(name); - if (propWrap.isEmpty()) { - log.debug("No property "+name+" found"); - if (removing) { - return; - } - } - - if (removing) { - PomTransformer.ContainerElement prop = propWrap.get(); - log.debug("Removing prop "+prop); - prop.remove(false, false); - return; - } - - log.debug("Adding to properties"); - props.addOrSetChildTextElement(name, value); - - }; - } - -} diff --git a/src/main/java/br/org/soujava/pomeditor/api/Dependency.java b/src/main/java/br/org/soujava/pomeditor/api/Dependency.java deleted file mode 100644 index 2028e7b..0000000 --- a/src/main/java/br/org/soujava/pomeditor/api/Dependency.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor.api; - -import java.util.Arrays; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * Represents a dependency to be added - */ -public final class Dependency { - - /** - * Returns a {@link DependencyBuilder} instance - * @return a {@link DependencyBuilder} - */ - public static DependencyBuilder builder() { - return new DependencyBuilder(); - } - - /** - * Returns a {@link DependencyBuilder} based on a GAV - groupId:artifactId:version - parameter - * - * @param gav a GAV - groupId:artifactId:version - parameter - * @return a {@link DependencyBuilder} - */ - public static DependencyBuilder ofGav(String gav) { - DependencyBuilder builder = builder(); - var gavValues = Arrays.stream(gav.split(":")) - .filter(Objects::nonNull) - .filter(item -> !item.isBlank()) - .map(String::trim) - .collect(Collectors.toList()); - if (gavValues.size() >= 1) - builder.withGroupId(gavValues.get(0)); - if (gavValues.size() >= 2) - builder.withArtifactId(gavValues.get(1)); - if (gavValues.size() >= 3) - builder.withVersion(gavValues.get(2)); - return builder; - } - - /** - * Dependency builder - */ - public static class DependencyBuilder { - - private String groupId; - private String artifactId; - private String version; - private String type; - private String classifier; - private String scope; - - /** - * @param groupId groupId - * @return the same {@link DependencyBuilder} instance - */ - public DependencyBuilder withGroupId(String groupId) { - this.groupId = groupId; - return this; - } - - /** - * @param artifactId artifactId - * @return the same {@link DependencyBuilder} instance - */ - public DependencyBuilder withArtifactId(String artifactId) { - this.artifactId = artifactId; - return this; - } - - /** - * @param version version - * @return the same {@link DependencyBuilder} instance - */ - public DependencyBuilder withVersion(String version) { - this.version = version; - return this; - } - - /** - * @param type type - * @return the same {@link DependencyBuilder} instance - */ - public DependencyBuilder withType(String type) { - this.type = type; - return this; - } - - /** - * @param classifier classifier - * @return the same {@link DependencyBuilder} instance - */ - public DependencyBuilder withClassifier(String classifier) { - this.classifier = classifier; - return this; - } - - /** - * @param scope scope - * @return the same {@link DependencyBuilder} instance - */ - public DependencyBuilder withScope(String scope) { - this.scope = scope; - return this; - } - - /** - * @return a {@link Dependency} instance - */ - public Dependency build() { - return new Dependency(groupId, artifactId, version, type, classifier, scope); - } - } - - private final String groupId; - private final String artifactId; - private final String version; - private final String type; - private final String classifier; - private final String scope; - - private Dependency(String groupId, String artifactId, String version, String type, String classifier, String scope) { - if (groupId == null || groupId.isBlank()) - throw new IllegalArgumentException("groupId must be provided"); - - if (artifactId == null || artifactId.isBlank()) - throw new IllegalArgumentException("artifactId must be provided"); - - this.groupId = groupId; - this.artifactId = artifactId; - this.version = version; - this.type = type; - this.classifier = classifier; - this.scope = scope; - } - - /** - * @return the groupId - */ - public String getGroupId() { - return groupId; - } - - /** - * @return artifactId - */ - public String getArtifactId() { - return artifactId; - } - - /** - * @return version - */ - public String getVersion() { - return version; - } - - /** - * @return type - */ - public String getType() { - return type; - } - - /** - * @return classifier - */ - public String getClassifier() { - return classifier; - } - - /** - * @return scope - */ - public String getScope() { - return scope; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Dependency that = (Dependency) o; - return Objects.equals(groupId, that.groupId) - && Objects.equals(artifactId, that.artifactId) - && Objects.equals(version, that.version) - && Objects.equals(type, that.type) - && Objects.equals(classifier, that.classifier) - && Objects.equals(scope, that.scope); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - sb.append("groupId='" + groupId + '\''); - sb.append(", artifactId='" + artifactId + '\''); - if (version != null) - sb.append(", version='" + version + '\''); - if (type != null) - sb.append(", type='" + type + '\''); - if (classifier != null) - sb.append(", classifier='" + classifier + '\''); - if (scope != null) - sb.append(", scope='" + scope + '\''); - sb.append("}"); - return sb.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(groupId, artifactId, version, type, classifier, scope); - } -} diff --git a/src/main/java/br/org/soujava/pomeditor/api/PomChange.java b/src/main/java/br/org/soujava/pomeditor/api/PomChange.java deleted file mode 100644 index b704f61..0000000 --- a/src/main/java/br/org/soujava/pomeditor/api/PomChange.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package br.org.soujava.pomeditor.api; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.Objects; -import java.util.Optional; -import java.util.function.Consumer; -import java.util.function.Function; - -/** - * Component responsible for POM changes with backup support - */ -public final class PomChange { - - public static Path backupFileOf(Path pom) { - Objects.requireNonNull(pom, "pom cannot be null"); - return Path.of(pom.toString() + ".backup"); - } - - private final Path pom; - private final Consumer logger; - private final Function backupFunction; - private final Consumer rollbackFunction; - - private PomChange(Path pom, - Consumer logger, - Function backupFunction, - Consumer rollbackFunction) { - Objects.requireNonNull(pom, "pom cannot be null"); - this.pom = pom; - this.logger = Optional.ofNullable(logger).orElse(System.out::println); - this.backupFunction = Optional.ofNullable(backupFunction).orElse(this::backup); - this.rollbackFunction = Optional.ofNullable(rollbackFunction).orElse(PomRollback::execute); - } - - public static PomChangeBuilder builder() { - return new PomChangeBuilder(); - } - - public static class PomChangeBuilder { - - private Path pom; - private Consumer logger = System.out::println; - private Function backupFunction; - private Consumer rollbackFunction; - - public PomChangeBuilder withLogger(Consumer logger) { - this.logger = logger; - return this; - } - - public PomChangeBuilder withPom(Path pom) { - this.pom = pom; - return this; - } - - public PomChangeBuilder withBackupFunction(Function backupFunction) { - this.backupFunction = backupFunction; - return this; - } - - public PomChangeBuilder withRollbackFunction(Consumer rollbackFunction) { - this.rollbackFunction = rollbackFunction; - return this; - } - - public PomChange build() { - return new PomChange(this.pom, this.logger, this.backupFunction, this.rollbackFunction); - } - - } - - @FunctionalInterface - public static interface Executable { - void execute() throws Throwable; - } - - public void execute(Executable executable) throws Throwable { - boolean createdBackupFile = false; - try { - createdBackupFile = createBackupFileIfNeeded(); - executable.execute(); - } catch (Throwable ex) { - rollback(createdBackupFile); - throw ex; - } - } - - private boolean createBackupFileIfNeeded() { - return Optional.ofNullable(this.backupFunction.apply(this.pom)) - .orElse(Boolean.FALSE); - } - - private void rollback(boolean isBackupOwner) { - if (isBackupOwner) { - this.rollbackFunction.accept(this.pom); - } - } - - private Boolean backup(Path pom) { - Path backupFile = backupFileOf(pom); - if (!backupFile.toFile().exists()) { - try { - Files.copy(pom, backupFile); - logger.accept(String.format("Backup for '%s' created: '%s'", - pom.toAbsolutePath(), - backupFile.toAbsolutePath())); - return true; - } catch (IOException e) { - throw new RuntimeException("failure during backup process:" + e.getMessage(), e); - } - } - return false; - } - -} diff --git a/src/main/java/br/org/soujava/pomeditor/api/PomCommit.java b/src/main/java/br/org/soujava/pomeditor/api/PomCommit.java deleted file mode 100644 index cecd3c8..0000000 --- a/src/main/java/br/org/soujava/pomeditor/api/PomCommit.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -package br.org.soujava.pomeditor.api; - -import java.nio.file.Path; -import java.util.Objects; - -/** - * Service component responsible for the commit logic - */ -public interface PomCommit { - - /** - * Confirms the changes of a given POM and deletes the backup POM file - * - * @param pom the target POM file - * @throws RuntimeException on any issue occurs during the rollback processing - */ - public static void execute(final Path pom) { - Objects.requireNonNull(pom, "pom cannot be null"); - Path backupFile = PomChange.backupFileOf(pom); - if (backupFile.toFile().exists()) { - backupFile.toFile().delete(); - } - } - -} diff --git a/src/main/java/br/org/soujava/pomeditor/api/PomRollback.java b/src/main/java/br/org/soujava/pomeditor/api/PomRollback.java deleted file mode 100644 index 0853c9f..0000000 --- a/src/main/java/br/org/soujava/pomeditor/api/PomRollback.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor.api; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardCopyOption; -import java.util.Objects; - -/** - * Service component responsible for the rollback logic - */ -public interface PomRollback { - - /** - * Recovers the backup POM file replacing the given POM file - * @param pom target POM file - * @throws RuntimeException on any issue occurs during the rollback processing - */ - public static void execute(Path pom) { - Objects.requireNonNull(pom, "pom cannot be null"); - Path backupFile = PomChange.backupFileOf(pom); - if (backupFile.toFile().exists()) { - try { - Files.copy(backupFile, pom, StandardCopyOption.REPLACE_EXISTING); - backupFile.toFile().delete(); - } catch (IOException e) { - throw new RuntimeException("error during rollback process: " + e.getMessage(), e); - } - } - } - -} diff --git a/src/main/java/br/org/soujava/pomeditor/api/Property.java b/src/main/java/br/org/soujava/pomeditor/api/Property.java deleted file mode 100644 index 1c02147..0000000 --- a/src/main/java/br/org/soujava/pomeditor/api/Property.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 2024 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor.api; - -import java.util.Objects; - -/** - * Represents a property to be changed - */ -public final class Property { - - /** - * Returns a {@link PropertyBuilder} instance - * @return a {@link PropertyBuilder} - */ - public static PropertyBuilder builder() { - return new PropertyBuilder(); - } - - /** - * Returns a {@link PropertyBuilder} based on the specified property name and value. - * @param name property name - * @param value property value, or {@code null} to request removal - * @return a {@link PropertyBuilder} - */ - public static PropertyBuilder of(String name, String value) { - - return builder().withName(name).withValue(value); - - } - - /** - * Dependency builder - */ - public static class PropertyBuilder { - - private String name; - private String value; - - /** - * @param name property name - * @return {@code this} {@link PropertyBuilder} instance - */ - public PropertyBuilder withName(String name) { - this.name = name; - return this; - } - - /** - * @param value property value - * @return {@code this} {@link PropertyBuilder} instance - */ - public PropertyBuilder withValue(String value) { - this.value = value; - return this; - } - - /** - * @return a new {@link Property} instance - */ - public Property build() { - return new Property(name, value); - } - } - - private final String name; - private final String value; - - private Property(String name, String value) { - - if (name == null || name.isBlank()) { - throw new IllegalArgumentException("name must be provided"); - } - - this.name = name; - this.value = value; - - } - - public String getName() { - return name; - } - - public String getValue() { - return value; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Property that = (Property) o; - return Objects.equals(name, that.name) - && Objects.equals(value, that.value); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("{"); - sb.append("name='").append(name).append('\''); - sb.append(", value='").append(value).append('\''); - sb.append("}"); - return sb.toString(); - } - - @Override - public int hashCode() { - return Objects.hash(name, value); - } -} diff --git a/src/main/java/br/org/soujava/pomeditor/mojo/AddDependencyMojo.java b/src/main/java/br/org/soujava/pomeditor/mojo/AddDependencyMojo.java deleted file mode 100644 index cf76f21..0000000 --- a/src/main/java/br/org/soujava/pomeditor/mojo/AddDependencyMojo.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor.mojo; - -import br.org.soujava.pomeditor.api.AddDependency; -import br.org.soujava.pomeditor.api.Dependency; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; - -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Optional; -import java.util.function.BiConsumer; - -/** - * Mojo responsible to add a given dependency to a target POM - * if such dependency is not declared - * or the given dependency's version is greater than the existent at target POM - */ -@Mojo(name = "add-dep") -public class AddDependencyMojo extends EditingMojo { - - @Parameter(property = "gav") - String gav; - @Parameter(property = "type") - String type; - @Parameter(property = "classifier") - String classifier; - @Parameter(property = "scope") - String scope; - - BiConsumer addDependencyCommand; - - @Override - public void execute() throws MojoExecutionException, MojoFailureException { - - Path pomFile = Paths.get(pom); - Dependency dependency = buildDependency(); - try { - getLog().info(String.format("trying to add the dependency: %s to the \"%s\" file...", dependency, pomFile)); - - change(pomFile).execute(() -> dependencyCommand().accept(pomFile, dependency)); - - getLog().info(String.format("added the dependency: %s to the \"%s\" file.", dependency, pomFile)); - } catch (Throwable ex) { - throw new MojoFailureException(String.format("cannot add the dependency: %s to the \"%s\" file: %s", - dependency, - pomFile, - ex.getMessage()), ex); - } - } - - private BiConsumer dependencyCommand() { - return Optional - .ofNullable(this.addDependencyCommand) - .orElse(AddDependency::execute); - } - - private Dependency buildDependency() throws MojoExecutionException { - try { - return Dependency - .ofGav(gav) - .withType(type) - .withClassifier(classifier) - .withScope(scope) - .build(); - } catch (RuntimeException ex) { - throw new MojoExecutionException(ex.getMessage(), ex); - } - } - - -} diff --git a/src/main/java/br/org/soujava/pomeditor/mojo/ChangePropertyMojo.java b/src/main/java/br/org/soujava/pomeditor/mojo/ChangePropertyMojo.java deleted file mode 100644 index b166f4d..0000000 --- a/src/main/java/br/org/soujava/pomeditor/mojo/ChangePropertyMojo.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2024 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor.mojo; - -import br.org.soujava.pomeditor.api.ChangeProperty; -import br.org.soujava.pomeditor.api.Property; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; - -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Optional; -import java.util.function.BiConsumer; - -/** - * Mojo responsible for setting (potentially overwriting), or removing a property value. - */ -@Mojo(name = "change-prop") -public class ChangePropertyMojo extends EditingMojo { - - @Parameter(property = "property", required = true) - String property; - @Parameter(property = "value") - String value; - - BiConsumer changePropertyCommand; - - @Override - public void execute() throws MojoExecutionException, MojoFailureException { - - Path pomFile = Paths.get(pom); - Property property = buildProperty(); - - try { - - getLog().info(String.format("Changing property %s on \"%s\" POM file...", property, pomFile)); - - change(pomFile).execute(() -> changePropertyCommand().accept(pomFile, property)); - - getLog().info(String.format("Handled property %s on \"%s\" POM file.", property, pomFile)); - - } catch (Throwable ex) { - throw new MojoFailureException(String.format("Failed to handle property %s on \"%s\" POM file: %s", - property, - pomFile, - ex.getMessage()), ex); - } - } - - private BiConsumer changePropertyCommand() { - return Optional - .ofNullable(this.changePropertyCommand) - .orElse((path,prop)->ChangeProperty.execute(getLog(), path, prop)); - } - - private Property buildProperty() throws MojoExecutionException { - try { - return Property.of(property, value).build(); - } catch (RuntimeException ex) { - throw new MojoExecutionException(ex.getMessage(), ex); - } - } - - -} diff --git a/src/main/java/br/org/soujava/pomeditor/mojo/CommitMojo.java b/src/main/java/br/org/soujava/pomeditor/mojo/CommitMojo.java deleted file mode 100644 index 33b655f..0000000 --- a/src/main/java/br/org/soujava/pomeditor/mojo/CommitMojo.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor.mojo; - -import br.org.soujava.pomeditor.api.PomCommit; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; - -import java.nio.file.Path; -import java.util.Optional; -import java.util.function.Consumer; - -/** - * Mojo responsible for committing the POM changes and removing the backup POM file - */ -@Mojo(name = "commit") -public class CommitMojo extends AbstractMojo { - - @Parameter(property = "pom", defaultValue = "pom.xml") - String pom = "pom.xml"; - - Consumer commitFunction; - - @Override - public void execute() throws MojoExecutionException, MojoFailureException { - Path targetPom = Path.of(this.pom); - try { - getLog().info(String.format("trying to commit the changes of the \"%s\" file...", targetPom)); - Optional.ofNullable(commitFunction) - .orElse(PomCommit::execute) - .accept(targetPom); - getLog().info("changes has been committed"); - } catch (RuntimeException ex) { - throw new MojoFailureException( - String.format("cannot commit the file \"%s\": %s", targetPom.toString(), ex.getMessage()), - ex - ); - } - } -} diff --git a/src/main/java/br/org/soujava/pomeditor/mojo/EditingMojo.java b/src/main/java/br/org/soujava/pomeditor/mojo/EditingMojo.java deleted file mode 100644 index 5d27037..0000000 --- a/src/main/java/br/org/soujava/pomeditor/mojo/EditingMojo.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2024 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor.mojo; - -import br.org.soujava.pomeditor.api.PomChange; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugins.annotations.Parameter; - -import java.nio.file.Path; -import java.util.function.Consumer; -import java.util.function.Function; - -/** - * Base class for {@link org.apache.maven.plugin.Mojo} functionality, - * containing common code for editing POM files, and unit testing. - */ -public abstract class EditingMojo extends AbstractMojo { - - @Parameter(property = "pom", defaultValue = "pom.xml") - String pom = "pom.xml"; - - - protected Function backupFunction; - protected Consumer rollbackFunction; - - - protected PomChange change(Path pomFile) { - return PomChange - .builder() - .withLogger(getLog()::info) - .withPom(pomFile) - .withBackupFunction(backupFunction) - .withRollbackFunction(rollbackFunction) - .build(); - } - -} diff --git a/src/main/java/br/org/soujava/pomeditor/mojo/GreetingMojo.java b/src/main/java/br/org/soujava/pomeditor/mojo/GreetingMojo.java deleted file mode 100644 index 3e15114..0000000 --- a/src/main/java/br/org/soujava/pomeditor/mojo/GreetingMojo.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor.mojo; - -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; - -/** - * Says "Hi" to the output - */ -@Mojo(name = "hello") -public class GreetingMojo extends AbstractMojo { - - @Parameter(property = "username") - String username; - - @Override - public void execute() { - - getLog().info(String.format("Hi, %s!", username)); - - } -} diff --git a/src/main/java/br/org/soujava/pomeditor/mojo/RollbackMojo.java b/src/main/java/br/org/soujava/pomeditor/mojo/RollbackMojo.java deleted file mode 100644 index 60faa47..0000000 --- a/src/main/java/br/org/soujava/pomeditor/mojo/RollbackMojo.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor.mojo; - -import br.org.soujava.pomeditor.api.PomRollback; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; - -import java.nio.file.Path; -import java.util.Optional; -import java.util.function.Consumer; - -/** - * Restore the target POM file with the backup POM file - */ -@Mojo(name = "rollback") -public class RollbackMojo extends AbstractMojo { - - @Parameter(property = "pom", defaultValue = "pom.xml") - String pom = "pom.xml"; - - Consumer rollbackFunction; - - @Override - public void execute() throws MojoExecutionException, MojoFailureException { - Path targetPom = Path.of(this.pom); - try { - getLog().info(String.format("trying to revert the \"%s\" file...", targetPom)); - Optional.ofNullable(rollbackFunction) - .orElse(PomRollback::execute) - .accept(targetPom); - getLog().info(String.format("\"%s\" file has been recovered. Backup file was deleted successfully.", targetPom)); - } catch (RuntimeException ex) { - throw new MojoFailureException( - String.format("cannot recover the \"%s\" file: %s", targetPom,ex.getMessage()), ex); - } - } -} diff --git a/src/test/java/br/org/soujava/pomeditor/CheckSum.java b/src/test/java/br/org/soujava/pomeditor/CheckSum.java deleted file mode 100644 index 86bb80b..0000000 --- a/src/test/java/br/org/soujava/pomeditor/CheckSum.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package br.org.soujava.pomeditor; - -import java.io.IOException; -import java.math.BigInteger; -import java.nio.file.Files; -import java.nio.file.Path; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - -/** - * Component to be used to get M5 checksum data from files - */ -public interface CheckSum { - - /** - * Return the MD5 checksum from given a file - * @param file file to be used in the MD5 calculation - * @return a string with the MD5 checksum - * @throws IOException {@see Files.readAllBytes(Path)} - * @throws NoSuchAlgorithmException {@see MessageDigest.getInstance(String)} - */ - static String checksum(Path file) throws IOException, NoSuchAlgorithmException { - byte[] data = Files.readAllBytes(file); - byte[] hash = MessageDigest.getInstance("MD5").digest(data); - String checksum = new BigInteger(1, hash).toString(16); - return checksum; - } -} diff --git a/src/test/java/br/org/soujava/pomeditor/InvalidGroupIdArtifactIdArgs.java b/src/test/java/br/org/soujava/pomeditor/InvalidGroupIdArtifactIdArgs.java deleted file mode 100644 index 27afbd4..0000000 --- a/src/test/java/br/org/soujava/pomeditor/InvalidGroupIdArtifactIdArgs.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor; - -import org.junit.jupiter.api.extension.ExtensionContext; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.ArgumentsProvider; - -import java.util.stream.Stream; - -import static org.junit.jupiter.params.provider.Arguments.arguments; - -public class InvalidGroupIdArtifactIdArgs implements ArgumentsProvider { - - @Override - public Stream provideArguments(ExtensionContext extensionContext) { - return Stream.of( - arguments( - null, // groupId, - null // artifactId, - ), - arguments( - null, // groupId, - "artifactId" // artifactId, - ), - arguments( - "groupId", // groupId, - null // artifactId, - ), - arguments( - "", // groupId, - "" // artifactId, - ), - arguments( - "", // groupId, - "artifactId" // artifactId, - ), - arguments( - "groupId", // groupId, - "" // artifactId, - ) - ); - } -} diff --git a/src/test/java/br/org/soujava/pomeditor/InvalidPropertyArgs.java b/src/test/java/br/org/soujava/pomeditor/InvalidPropertyArgs.java deleted file mode 100644 index 9f34798..0000000 --- a/src/test/java/br/org/soujava/pomeditor/InvalidPropertyArgs.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2024 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor; - -import org.junit.jupiter.api.extension.ExtensionContext; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.ArgumentsProvider; - -import java.util.stream.Stream; - -import static org.junit.jupiter.params.provider.Arguments.arguments; - -public class InvalidPropertyArgs implements ArgumentsProvider { - - @Override - public Stream provideArguments(ExtensionContext extensionContext) { - return Stream.of( - arguments( - null, - null - ), - arguments( - null, - "not null" - ), - arguments( - "", - "not null" - ), - arguments( - "", - null - ), - arguments( - " ", - null - ), - arguments( - "\t", - null - ) - ); - } -} diff --git a/src/test/java/br/org/soujava/pomeditor/ValidDependenciesArgs.java b/src/test/java/br/org/soujava/pomeditor/ValidDependenciesArgs.java deleted file mode 100644 index 1790951..0000000 --- a/src/test/java/br/org/soujava/pomeditor/ValidDependenciesArgs.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor; - -import org.junit.jupiter.api.extension.ExtensionContext; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.ArgumentsProvider; - -import java.util.UUID; -import java.util.stream.Stream; - -import static org.junit.jupiter.params.provider.Arguments.arguments; - -public class ValidDependenciesArgs implements ArgumentsProvider { - - @Override - public Stream provideArguments(ExtensionContext extensionContext) { - return Stream.of( - arguments( - UUID.randomUUID().toString(), // groupId - UUID.randomUUID().toString(), // artifactId - UUID.randomUUID().toString(), // version - null // artifactId, - ), - arguments( - null, // groupId, - "artifactId" // artifactId, - ), - arguments( - "groupId", // groupId, - null // artifactId, - ), - arguments( - "", // groupId, - "" // artifactId, - ), - arguments( - "", // groupId, - "artifactId" // artifactId, - ), - arguments( - "groupId", // groupId, - "" // artifactId, - ) - ); - } -} diff --git a/src/test/java/br/org/soujava/pomeditor/api/BaseTest.java b/src/test/java/br/org/soujava/pomeditor/api/BaseTest.java deleted file mode 100644 index 383a222..0000000 --- a/src/test/java/br/org/soujava/pomeditor/api/BaseTest.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor.api; - -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardOpenOption; -import java.util.Arrays; -import java.util.Optional; -import java.util.UUID; - -public abstract class BaseTest { - - protected Path pom; - protected Path tempDir; - - PomChange.PomChangeBuilder newPomChangeBuilder() { - return PomChange.builder() - .withLogger((string)->{}) - .withPom(pom); - } - - // utility methods - - void modifyPomRandomly() throws IOException { - modifyPom(UUID.randomUUID().toString()); - } - - void modifyPom(String data) throws IOException { - Files.writeString(pom, data, StandardOpenOption.TRUNCATE_EXISTING); - } - - Path newDummyPom() throws IOException { - Path pom = Files.createTempFile(tempDir, "pom", ".xml"); - Files.writeString(pom, UUID.randomUUID().toString(), StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.WRITE); - return pom; - } - - Path newDummyBackup(Path pom) throws IOException { - Path backupFile = PomChange.backupFileOf(pom); - Files.writeString(backupFile, UUID.randomUUID().toString(), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.WRITE); - return backupFile; - } - - @BeforeEach - void createTempDirAndPom() throws IOException { - this.tempDir = Files.createTempDirectory(null); - this.pom = newDummyPom(); - } - - @AfterEach - void destroyTempDir() { - Optional.ofNullable(tempDir).ifPresent(tempDir -> delete(tempDir.toFile())); - } - - - void delete(File file) { - if (file.isDirectory()) { - Arrays.stream(file.listFiles()).forEach(this::delete); - } - file.delete(); - } - -} diff --git a/src/test/java/br/org/soujava/pomeditor/api/DependencyTest.java b/src/test/java/br/org/soujava/pomeditor/api/DependencyTest.java deleted file mode 100644 index 35f4d18..0000000 --- a/src/test/java/br/org/soujava/pomeditor/api/DependencyTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor.api; - -import br.org.soujava.pomeditor.InvalidGroupIdArtifactIdArgs; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ArgumentsSource; - -import java.util.Arrays; -import java.util.Objects; -import java.util.stream.Collectors; - -class DependencyTest { - - @DisplayName("should return error when") - @ParameterizedTest(name = "groupId={0}, artifactId={1}") - @ArgumentsSource(InvalidGroupIdArtifactIdArgs.class) - void shouldReturnErrors (final String groupId, final String artifactId) { - Assertions.assertThrows(IllegalArgumentException.class, () -> { - var gav = Arrays.stream(new String[]{groupId, artifactId}) - .filter(Objects::nonNull) - .collect(Collectors.joining(":")); - Dependency.ofGav(gav).build(); - }); - - Assertions.assertThrows(IllegalArgumentException.class, () -> { - Dependency.builder() - .withGroupId(groupId) - .withArtifactId(artifactId).build(); - }); - } - - - @DisplayName("should return error when") - @ParameterizedTest(name = "groupId={0}, artifactId={1}") - @ArgumentsSource(InvalidGroupIdArtifactIdArgs.class) - void shouldReturnErrorsForInvalidRequiredParameters(final String groupId, - final String artifactId) { - Assertions.assertThrows(IllegalArgumentException.class, () -> { - var gav = Arrays.stream(new String[]{groupId, artifactId}) - .filter(Objects::nonNull) - .collect(Collectors.joining(":")); - Dependency.ofGav(gav).build(); - }); - - Assertions.assertThrows(IllegalArgumentException.class, () -> { - Dependency.builder() - .withGroupId(groupId) - .withArtifactId(artifactId).build(); - }); - } - -} \ No newline at end of file diff --git a/src/test/java/br/org/soujava/pomeditor/api/PomChangeTest.java b/src/test/java/br/org/soujava/pomeditor/api/PomChangeTest.java deleted file mode 100644 index 10b09ad..0000000 --- a/src/test/java/br/org/soujava/pomeditor/api/PomChangeTest.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor.api; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Nested; -import org.junit.jupiter.api.Test; - -import java.io.IOException; -import java.nio.file.Path; -import java.security.NoSuchAlgorithmException; - -import static br.org.soujava.pomeditor.CheckSum.checksum; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; - -class PomChangeTest extends BaseTest { - - @Nested - class WhenBackFileDoesNotExists { - - Path backupPom; - - @BeforeEach - void setup() throws IOException { - createTempDirAndPom(); - this.backupPom = PomChange.backupFileOf(pom); - if (this.backupPom.toFile().exists()) - this.backupPom.toFile().delete(); - } - - @Test - void shouldCreateBackup() throws Throwable { - var expectedCheckSum = checksum(pom); - - newPomChangeBuilder().build() - .execute(() -> { - // do something here - }); - assertTrue(backupPom.toFile().exists()); - assertEquals(expectedCheckSum, checksum(backupPom)); - } - - @Test - void shouldRollbackOnErrors() throws IOException, NoSuchAlgorithmException { - var expectedCheckSum = checksum(pom); - - assertThrows(Throwable.class, () -> { - newPomChangeBuilder() - .build().execute(() -> { - modifyPomRandomly(); - throw new RuntimeException("forced error"); - }); - }); - assertFalse(backupPom.toFile().exists()); - assertEquals(expectedCheckSum, checksum(pom)); - } - } - - - @Nested - class WhenBackFileAlreadyExists { - - Path backupPom; - - @BeforeEach - void setup() throws IOException { - createTempDirAndPom(); - backupPom = newDummyBackup(pom); - } - - @Test - void shouldNotCreateBackup() throws Throwable { - - var expectedCheckSum = checksum(backupPom); - - newPomChangeBuilder() - .build() - .execute(() -> { - modifyPomRandomly(); - }); - - assertNotEquals(checksum(pom), checksum(backupPom)); - assertEquals(expectedCheckSum, checksum(backupPom)); - } - - @Test - void shouldNotRollbackOnErrors() throws IOException, NoSuchAlgorithmException { - var expectedCheckSum = checksum(pom); - - assertThrows(Throwable.class, () -> { - newPomChangeBuilder() - .build().execute(() -> { - modifyPomRandomly(); - throw new RuntimeException("forced error"); - }); - }); - - assertTrue(backupPom.toFile().exists()); - assertNotEquals(expectedCheckSum, checksum(pom)); - } - - } - - -} \ No newline at end of file diff --git a/src/test/java/br/org/soujava/pomeditor/api/PomCommitTest.java b/src/test/java/br/org/soujava/pomeditor/api/PomCommitTest.java deleted file mode 100644 index 5f76654..0000000 --- a/src/test/java/br/org/soujava/pomeditor/api/PomCommitTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor.api; - -import org.junit.jupiter.api.Test; - -import java.io.IOException; -import java.nio.file.Path; -import java.security.NoSuchAlgorithmException; - -import static br.org.soujava.pomeditor.CheckSum.checksum; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; - -class PomCommitTest extends BaseTest { - - @Test - void shouldCommit() throws IOException, NoSuchAlgorithmException { - - Path backup = newDummyBackup(pom); - - String expectedCheckSum = checksum(pom); - assertNotEquals(expectedCheckSum, checksum(backup)); - - PomCommit.execute(pom); - - assertTrue(pom.toFile().exists()); - assertFalse(backup.toFile().exists()); - - assertEquals(expectedCheckSum, checksum(pom)); - - } - -} diff --git a/src/test/java/br/org/soujava/pomeditor/api/PomRollbackTest.java b/src/test/java/br/org/soujava/pomeditor/api/PomRollbackTest.java deleted file mode 100644 index c6aae3a..0000000 --- a/src/test/java/br/org/soujava/pomeditor/api/PomRollbackTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor.api; - -import org.junit.jupiter.api.Test; - -import java.io.IOException; -import java.nio.file.Path; -import java.security.NoSuchAlgorithmException; - -import static br.org.soujava.pomeditor.CheckSum.checksum; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; - -class PomRollbackTest extends BaseTest{ - - @Test - void shouldRollback() throws IOException, NoSuchAlgorithmException { - - Path pom = newDummyPom(); - Path backup = newDummyBackup(pom); - - String expectedCheckSum = checksum(backup); - assertNotEquals(expectedCheckSum, checksum(pom)); - - PomRollback.execute(pom); - - assertTrue(pom.toFile().exists()); - assertFalse(backup.toFile().exists()); - - assertEquals(expectedCheckSum, checksum(pom)); - - } - -} diff --git a/src/test/java/br/org/soujava/pomeditor/api/PropertiesTest.java b/src/test/java/br/org/soujava/pomeditor/api/PropertiesTest.java deleted file mode 100644 index d0b22d8..0000000 --- a/src/test/java/br/org/soujava/pomeditor/api/PropertiesTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2024 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor.api; - -import br.org.soujava.pomeditor.InvalidPropertyArgs; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ArgumentsSource; - -class PropertiesTest { - - @DisplayName("should return error when") - @ParameterizedTest(name = "property={0}, value={1}") - @ArgumentsSource(InvalidPropertyArgs.class) - void shouldReturnErrors (final String property, final String value) { - Assertions.assertThrows(IllegalArgumentException.class, () -> - Property.of(property, value).build()); - - Assertions.assertThrows(IllegalArgumentException.class, () -> - Property.builder() - .withName(property) - .withValue(value).build()); - } - -} \ No newline at end of file diff --git a/src/test/java/br/org/soujava/pomeditor/it/AddDependencyMojoIT.java b/src/test/java/br/org/soujava/pomeditor/it/AddDependencyMojoIT.java deleted file mode 100644 index 25cd9ff..0000000 --- a/src/test/java/br/org/soujava/pomeditor/it/AddDependencyMojoIT.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package br.org.soujava.pomeditor.it; - -import com.soebes.itf.jupiter.extension.MavenGoal; -import com.soebes.itf.jupiter.extension.MavenJupiterExtension; -import com.soebes.itf.jupiter.extension.MavenTest; -import com.soebes.itf.jupiter.extension.SystemProperty; -import com.soebes.itf.jupiter.maven.MavenExecutionResult; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.DisplayName; -import org.w3c.dom.Document; -import org.w3c.dom.NodeList; - -import javax.xml.xpath.XPathExpressionException; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -import static com.soebes.itf.extension.assertj.MavenExecutionResultAssert.assertThat; - -@MavenJupiterExtension -@MavenGoal("${project.groupId}:${project.artifactId}:${project.version}:add-dep") -@SystemProperty(value = "gav", content = AddDependencyMojoIT.orgJunitJupiterGav) -public class AddDependencyMojoIT extends EditingMojoIT { - - static final String orgJunitJupiterGroupId = "org.junit.jupiter"; - static final String junitJupiterArtifactId = "junit-jupiter"; - static final String version5_9_0 = "5.9.0"; - static final String orgJunitJupiterGav = orgJunitJupiterGroupId + ":" + junitJupiterArtifactId + ":" + version5_9_0; - - @MavenTest - @DisplayName("adding given a dependency into a POM without dependencies") - void no_dependencies_declarated(MavenExecutionResult result) throws Exception { - shouldAddDependency(result); - } - - - @MavenTest - @DisplayName("adding given a dependency into a POM with other dependencies") - void with_other_dependencies(MavenExecutionResult result) throws Exception { - shouldAddDependency(result); - } - - @MavenTest - @DisplayName("adding given a dependency into a POM that has the dependency already") - void has_dependency_already(MavenExecutionResult result) throws Exception { - shouldAddDependency(result); - } - - @MavenTest - @DisplayName("adding given a dependency into a POM that has the dependency already but with version higher") - void has_dependency_but_with_version_higher(MavenExecutionResult result) throws Exception { - shouldAddDependency(result); - } - - @MavenTest - @DisplayName("adding given a dependency into a POM that has the dependency already but with version higher") - void has_dependency_but_with_version_lower(MavenExecutionResult result) throws Exception { - shouldAddDependency(result); - } - - private static void shouldAddDependency(MavenExecutionResult result) throws XPathExpressionException { - assertThat(result) - .isSuccessful(); - Path baseDir = result.getMavenProjectResult().getTargetProjectDirectory(); - shouldHaveGeneratedBackFile(baseDir); - shouldAddDependency(baseDir, orgJunitJupiterGroupId, junitJupiterArtifactId, version5_9_0); - } - - private static void shouldAddDependency(Path baseDir, String groupId, String artifactId, String version) throws XPathExpressionException { - - Path pom = Path.of(baseDir.toString(), "pom.xml"); - - Document doc = getDoc(pom); - - String expression = xmlPathToGetDependencies(groupId, artifactId, version); - - NodeList dependencies = findByXPath(doc, expression); - - Assertions.assertThat(dependencies.getLength()).isEqualTo(1); - } - - private static String xmlPathToGetDependencies(String groupId, String artifactId, String version) { - StringBuilder xpathExpression = new StringBuilder("/project/dependencies/dependency"); - List attributes = new ArrayList<>(); - if (groupId != null) - attributes.add("groupId=\"" + groupId + "\""); - if (artifactId != null) - attributes.add("artifactId=\"" + artifactId + "\""); - if (version != null) - attributes.add("version=\"" + version + "\""); - if (!attributes.isEmpty()) { - xpathExpression.append("["); - xpathExpression.append(attributes.stream().collect(Collectors.joining(" and "))); - xpathExpression.append("]"); - } - return xpathExpression.toString(); - } - -} diff --git a/src/test/java/br/org/soujava/pomeditor/it/ChangePropertyMojoIT.java b/src/test/java/br/org/soujava/pomeditor/it/ChangePropertyMojoIT.java deleted file mode 100644 index 62b5c51..0000000 --- a/src/test/java/br/org/soujava/pomeditor/it/ChangePropertyMojoIT.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2024 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package br.org.soujava.pomeditor.it; - -import com.soebes.itf.jupiter.extension.MavenGoal; -import com.soebes.itf.jupiter.extension.MavenJupiterExtension; -import com.soebes.itf.jupiter.extension.MavenTest; -import com.soebes.itf.jupiter.extension.SystemProperty; -import com.soebes.itf.jupiter.maven.MavenExecutionResult; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.DisplayName; -import org.w3c.dom.Document; -import org.w3c.dom.NodeList; - -import javax.xml.xpath.XPathExpressionException; -import java.nio.file.Path; - -import static com.soebes.itf.extension.assertj.MavenExecutionResultAssert.assertThat; - -@MavenJupiterExtension -@MavenGoal("${project.groupId}:${project.artifactId}:${project.version}:change-prop") -// @MavenOption("-X") // for debugging -@SystemProperty(value = "property", content = ChangePropertyMojoIT.propName) -@SystemProperty(value = "value", content = ChangePropertyMojoIT.value) -public class ChangePropertyMojoIT extends EditingMojoIT { - - static final String propName = "uncertainty"; - static final String value = "principal"; - - @MavenTest - @DisplayName("property added when there were no properties") - void had_no_properties(MavenExecutionResult result) throws Exception { - validateProperty(result, 1); - } - - @MavenTest - @DisplayName("property added when there was no property") - void had_no_property(MavenExecutionResult result) throws Exception { - validateProperty(result, 2); - } - - @MavenTest - @DisplayName("property unchanged when it was set to the same value") - void had_same_property(MavenExecutionResult result) throws Exception { - validateProperty(result, 2); - } - - @MavenTest - @DisplayName("property changed when it was set to a different value") - void had_different_property(MavenExecutionResult result) throws Exception { - validateProperty(result, 2); - } - - private static void validateProperty(MavenExecutionResult result, int totalProps) throws XPathExpressionException { - assertThat(result) - .isSuccessful(); - Path baseDir = result.getMavenProjectResult().getTargetProjectDirectory(); - shouldHaveGeneratedBackFile(baseDir); - shouldHaveProperty(baseDir, totalProps, propName, value); - } - - private static void shouldHaveProperty(Path baseDir, int totalProps, String name, String value) throws XPathExpressionException { - - Path pom = Path.of(baseDir.toString(), "pom.xml"); - - Document doc = getDoc(pom); - - NodeList nlp = findByXPath(doc, "/project/properties/*"); - Assertions.assertThat(nlp.getLength()).isEqualTo(totalProps); - - NodeList nl = findByXPath(doc, "/project/properties/"+name); - Assertions.assertThat(nl.getLength()).isEqualTo(1); - - Assertions.assertThat(nl.item(0).getTextContent()).isEqualTo(value); - } - -} diff --git a/src/test/java/br/org/soujava/pomeditor/it/CommitMojoIT.java b/src/test/java/br/org/soujava/pomeditor/it/CommitMojoIT.java deleted file mode 100644 index df7b242..0000000 --- a/src/test/java/br/org/soujava/pomeditor/it/CommitMojoIT.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package br.org.soujava.pomeditor.it; - -import com.soebes.itf.jupiter.extension.MavenGoal; -import com.soebes.itf.jupiter.extension.MavenJupiterExtension; -import com.soebes.itf.jupiter.extension.MavenTest; -import com.soebes.itf.jupiter.maven.MavenExecutionResult; -import com.soebes.itf.jupiter.maven.MavenProjectResult; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; - -import java.nio.file.Path; -import java.nio.file.Paths; - -import static br.org.soujava.pomeditor.CheckSum.checksum; -import static com.soebes.itf.extension.assertj.MavenExecutionResultAssert.assertThat; - -@MavenJupiterExtension -@MavenGoal("${project.groupId}:${project.artifactId}:${project.version}:commit") -class CommitMojoIT { - - String expectedChecksum; - - @BeforeEach - void beforeEach(MavenProjectResult project) throws Exception { - Path pom = project.getTargetProjectDirectory().resolve("pom.xml"); - expectedChecksum = checksum(pom); - } - - - @MavenTest - @DisplayName("committing the changes - it will remove the backup file") - void project_with_backup(MavenExecutionResult result) throws Exception { - assertThat(result).isSuccessful(); - Path baseDirectory = result.getMavenProjectResult().getTargetProjectDirectory(); - Path pom = Path.of(baseDirectory.toString(), "pom.xml"); - Path backupPom = Paths.get(baseDirectory.toString(), "pom.xml.backup"); - Assertions.assertThat(backupPom).doesNotExist(); - Assertions.assertThat(checksum(pom)).isEqualTo(expectedChecksum); - } -} diff --git a/src/test/java/br/org/soujava/pomeditor/it/EditingMojoIT.java b/src/test/java/br/org/soujava/pomeditor/it/EditingMojoIT.java deleted file mode 100644 index 3902611..0000000 --- a/src/test/java/br/org/soujava/pomeditor/it/EditingMojoIT.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2024 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package br.org.soujava.pomeditor.it; - -import org.assertj.core.api.Assertions; -import org.w3c.dom.Document; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; - -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; -import java.io.IOException; -import java.nio.file.Path; - -public abstract class EditingMojoIT { - - static void shouldHaveGeneratedBackFile(Path baseDir) { - Path backup = Path.of(baseDir.toString(), "pom.xml.backup"); - Assertions.assertThat(backup).exists(); - } - - static final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - - static { - try { - // optional, but recommended - // process XML securely, avoid attacks like XML External Entities (XXE) - dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - dbf.setIgnoringComments(false); - } catch (ParserConfigurationException e) { - throw new RuntimeException(e); - } - } - - static Document getDoc(Path path) { - // parse XML file - try { - DocumentBuilder db = dbf.newDocumentBuilder(); - return db.parse(path.toFile()); - } catch (ParserConfigurationException e) { - throw new RuntimeException(e); - } catch (IOException e) { - throw new RuntimeException(e); - } catch (SAXException e) { - throw new RuntimeException(e); - } - } - - static NodeList findByXPath(Document doc, String xpathExpression) throws XPathExpressionException { - XPath xPath = XPathFactory.newInstance().newXPath(); - return (NodeList) xPath.compile(xpathExpression).evaluate(doc, XPathConstants.NODESET); - } - -} diff --git a/src/test/java/br/org/soujava/pomeditor/it/GreetingMojoIT.java b/src/test/java/br/org/soujava/pomeditor/it/GreetingMojoIT.java deleted file mode 100644 index 27810d3..0000000 --- a/src/test/java/br/org/soujava/pomeditor/it/GreetingMojoIT.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package br.org.soujava.pomeditor.it; - -import com.soebes.itf.jupiter.extension.MavenGoal; -import com.soebes.itf.jupiter.extension.MavenJupiterExtension; -import com.soebes.itf.jupiter.extension.MavenTest; -import com.soebes.itf.jupiter.extension.SystemProperty; -import com.soebes.itf.jupiter.maven.MavenExecutionResult; - -import static com.soebes.itf.extension.assertj.MavenITAssertions.assertThat; - -@MavenJupiterExtension -class GreetingMojoIT { - - @MavenTest - @MavenGoal("${project.groupId}:${project.artifactId}:${project.version}:hello") - @SystemProperty(value = "username", content = "Max") - void hello(MavenExecutionResult result) { - assertThat(result) - .isSuccessful() - .out() - .info().contains("Hi, Max!"); - } - -} diff --git a/src/test/java/br/org/soujava/pomeditor/it/RemovePropertyMojoIT.java b/src/test/java/br/org/soujava/pomeditor/it/RemovePropertyMojoIT.java deleted file mode 100644 index 4187118..0000000 --- a/src/test/java/br/org/soujava/pomeditor/it/RemovePropertyMojoIT.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2024 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package br.org.soujava.pomeditor.it; - -import com.soebes.itf.jupiter.extension.MavenGoal; -import com.soebes.itf.jupiter.extension.MavenJupiterExtension; -import com.soebes.itf.jupiter.extension.MavenTest; -import com.soebes.itf.jupiter.extension.SystemProperty; -import com.soebes.itf.jupiter.maven.MavenExecutionResult; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.DisplayName; -import org.w3c.dom.Document; -import org.w3c.dom.NodeList; - -import javax.xml.xpath.XPathExpressionException; -import java.nio.file.Path; - -import static com.soebes.itf.extension.assertj.MavenExecutionResultAssert.assertThat; - -@MavenJupiterExtension -@MavenGoal("${project.groupId}:${project.artifactId}:${project.version}:change-prop") -//@MavenOption("-X") // for debugging -@SystemProperty(value = "property", content = RemovePropertyMojoIT.propName) -//@SystemProperty(value = "value") // or else it's set to "true" -public class RemovePropertyMojoIT extends EditingMojoIT { - - static final String propName = "disappear"; - - @MavenTest - @DisplayName("no changes to pom if no ") - void had_no_properties(MavenExecutionResult result) throws Exception { - validateProperty(result, false, 0); - } - - @MavenTest - @DisplayName("no changes to pom if no specific property") - void had_no_property(MavenExecutionResult result) throws Exception { - validateProperty(result, true, 1); - } - - @MavenTest - @DisplayName("property removed") - void property_removed(MavenExecutionResult result) throws Exception { - validateProperty(result, true, 1); - } - - @MavenTest - @DisplayName("the only property removed") - void the_only_property_removed(MavenExecutionResult result) throws Exception { - validateProperty(result, true, 0); - } - - private static void validateProperty(MavenExecutionResult result, boolean propertiesNode, int propsLeft) throws XPathExpressionException { - assertThat(result) - .isSuccessful(); - Path baseDir = result.getMavenProjectResult().getTargetProjectDirectory(); - shouldHaveGeneratedBackFile(baseDir); - shouldNotHaveProperty(baseDir, propName, propertiesNode, propsLeft); - } - - private static void shouldNotHaveProperty(Path baseDir, String name, boolean propertiesNode, int propsLeft) throws XPathExpressionException { - - Path pom = Path.of(baseDir.toString(), "pom.xml"); - - Document doc = getDoc(pom); - - if (!propertiesNode) { - NodeList properties = findByXPath(doc, "/project/properties"); - Assertions.assertThat(properties.getLength()).isEqualTo(0); - return; - } - - NodeList nlp = findByXPath(doc, "/project/properties/*"); - Assertions.assertThat(nlp.getLength()).isEqualTo(propsLeft); - - NodeList nl = findByXPath(doc, "/project/properties/"+name); - Assertions.assertThat(nl.getLength()).isEqualTo(0); - - } - -} diff --git a/src/test/java/br/org/soujava/pomeditor/it/RollbackMojoIT.java b/src/test/java/br/org/soujava/pomeditor/it/RollbackMojoIT.java deleted file mode 100644 index a813ddb..0000000 --- a/src/test/java/br/org/soujava/pomeditor/it/RollbackMojoIT.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package br.org.soujava.pomeditor.it; - -import com.soebes.itf.jupiter.extension.MavenGoal; -import com.soebes.itf.jupiter.extension.MavenJupiterExtension; -import com.soebes.itf.jupiter.extension.MavenTest; -import com.soebes.itf.jupiter.maven.MavenExecutionResult; -import com.soebes.itf.jupiter.maven.MavenProjectResult; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; - -import java.nio.file.Path; -import java.nio.file.Paths; - -import static br.org.soujava.pomeditor.CheckSum.checksum; -import static com.soebes.itf.extension.assertj.MavenExecutionResultAssert.assertThat; - -@MavenJupiterExtension -@MavenGoal("${project.groupId}:${project.artifactId}:${project.version}:rollback") -class RollbackMojoIT { - - String expectedChecksum; - - @BeforeEach - void beforeEach(MavenProjectResult project) throws Exception { - Path backupPom = project.getTargetProjectDirectory().resolve("pom.xml.backup"); - expectedChecksum = checksum(backupPom); - } - - - @MavenTest - @DisplayName("reverting the changes - it will remove the backup file") - void project_with_backup(MavenExecutionResult result) throws Exception { - assertThat(result).isSuccessful(); - Path baseDirectory = result.getMavenProjectResult().getTargetProjectDirectory(); - Path pom = Path.of(baseDirectory.toString(), "pom.xml"); - Path backupPom = Paths.get(baseDirectory.toString(), "pom.xml.backup"); - Assertions.assertThat(backupPom).doesNotExist(); - Assertions.assertThat(checksum(pom)).isEqualTo(expectedChecksum); - } -} diff --git a/src/test/java/br/org/soujava/pomeditor/mojo/AddDependencyMojoTest.java b/src/test/java/br/org/soujava/pomeditor/mojo/AddDependencyMojoTest.java deleted file mode 100644 index 61b31d6..0000000 --- a/src/test/java/br/org/soujava/pomeditor/mojo/AddDependencyMojoTest.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor.mojo; - - -import br.org.soujava.pomeditor.InvalidGroupIdArtifactIdArgs; -import br.org.soujava.pomeditor.api.Dependency; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ArgumentsSource; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; - -import java.nio.file.Path; -import java.util.Arrays; -import java.util.Objects; -import java.util.function.BiConsumer; -import java.util.stream.Collectors; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; - -@ExtendWith(MockitoExtension.class) -class AddDependencyMojoTest extends EditingMojoTest { - - @Mock - BiConsumer addDependencyCommand; - - @Captor - ArgumentCaptor dependencyToBeAdded; - - @DisplayName("should return error when") - @ParameterizedTest(name = "groupId={0}, artifactId={1}") - @ArgumentsSource(InvalidGroupIdArtifactIdArgs.class) - void shouldReturnErrorsForInvalidRequiredParameters(final String groupId, - final String artifactId) { - Assertions.assertThrows(MojoExecutionException.class, () -> { - AddDependencyMojo mojo = newMojo(); - mojo.gav = Arrays.stream(new String[]{groupId, artifactId}) - .filter(Objects::nonNull) - .collect(Collectors.joining(":")); - mojo.execute(); - }); - - verify(backupFunction, never()).apply(any()); - verify(rollbackFunction, never()).accept(any()); - } - - @Test - void shouldAddDependencyProperly() throws MojoExecutionException, MojoFailureException { - - //Given - String expectedGroupId = "groupId"; - String expectedArtifactId = "artifactId"; - String expectedVersion = "222"; - - AddDependencyMojo mojo = newMojo(); - mojo.gav = expectedGroupId + ":" + expectedArtifactId + ":" + expectedVersion; - mojo.type = "jar"; - mojo.classifier = "classified"; - mojo.scope = "compile"; - - - //When - mojo.execute(); - - //Then - verify(addDependencyCommand, atLeastOnce()).accept(targetPom.capture(), dependencyToBeAdded.capture()); - verify(backupFunction, atLeastOnce()).apply(any(Path.class)); - verify(rollbackFunction, never()).accept(any()); - verify(log, atLeastOnce()).info(anyString()); - - var addDependency = this.dependencyToBeAdded.getValue(); - assertThat(targetPom.getValue()).isEqualTo(Path.of(mojo.pom)); - assertThat(addDependency.getGroupId()).isEqualTo(expectedGroupId); - assertThat(addDependency.getArtifactId()).isEqualTo(expectedArtifactId); - assertThat(addDependency.getVersion()).isEqualTo(expectedVersion); - assertThat(addDependency.getType()).isEqualTo(mojo.type); - assertThat(addDependency.getClassifier()).isEqualTo(mojo.classifier); - assertThat(addDependency.getScope()).isEqualTo(mojo.scope); - - } - - private AddDependencyMojo newMojo() { - AddDependencyMojo mojo = new AddDependencyMojo(); - mojo.pom = this.pom.toString(); - mojo.setLog(log); - mojo.backupFunction = backupFunction; - mojo.rollbackFunction = rollbackFunction; - mojo.addDependencyCommand = - (path, dep) -> addDependencyCommand.accept(path, dep); - return mojo; - } - -} diff --git a/src/test/java/br/org/soujava/pomeditor/mojo/ChangePropertyMojoTest.java b/src/test/java/br/org/soujava/pomeditor/mojo/ChangePropertyMojoTest.java deleted file mode 100644 index e548eca..0000000 --- a/src/test/java/br/org/soujava/pomeditor/mojo/ChangePropertyMojoTest.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright 2024 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor.mojo; - - -import br.org.soujava.pomeditor.InvalidPropertyArgs; -import br.org.soujava.pomeditor.api.Property; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ArgumentsSource; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; - -import java.nio.file.Path; -import java.util.function.BiConsumer; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; - -@ExtendWith(MockitoExtension.class) -class ChangePropertyMojoTest extends EditingMojoTest { - - @Mock - BiConsumer changePropertyCommand; - - @Captor - ArgumentCaptor propertyToBeAdded; - - @DisplayName("should return error when") - @ParameterizedTest(name = "property={0}, value={1}") - @ArgumentsSource(InvalidPropertyArgs.class) - void shouldReturnErrorsForInvalidRequiredParameters(final String property, - final String value) { - Assertions.assertThrows(MojoExecutionException.class, () -> { - - ChangePropertyMojo mojo = newMojo(); - mojo.property = property; - mojo.value = value; - mojo.execute(); - }); - - verify(backupFunction, never()).apply(any()); - verify(rollbackFunction, never()).accept(any()); - } - - @Test - void shouldSetPropertyProperly() throws MojoExecutionException, MojoFailureException { - - //Given - String expectedProp = "vanilla"; - String expectedVal = "sky"; - - ChangePropertyMojo mojo = newMojo(); - mojo.property = expectedProp; - mojo.value = expectedVal; - - //When - mojo.execute(); - - //Then - verify(changePropertyCommand, atLeastOnce()).accept(targetPom.capture(), propertyToBeAdded.capture()); - verify(backupFunction, atLeastOnce()).apply(any(Path.class)); - verify(rollbackFunction, never()).accept(any()); - verify(log, atLeastOnce()).info(anyString()); - - var addedProperty = this.propertyToBeAdded.getValue(); - assertThat(targetPom.getValue()).isEqualTo(Path.of(mojo.pom)); - assertThat(addedProperty.getName()).isEqualTo(expectedProp); - assertThat(addedProperty.getValue()).isEqualTo(expectedVal); - - } - - private ChangePropertyMojo newMojo() { - ChangePropertyMojo mojo = new ChangePropertyMojo(); - mojo.pom = this.pom.toString(); - mojo.setLog(log); - mojo.backupFunction = backupFunction; - mojo.rollbackFunction = rollbackFunction; - mojo.changePropertyCommand = - (path, dep) -> changePropertyCommand.accept(path, dep); - return mojo; - } - -} diff --git a/src/test/java/br/org/soujava/pomeditor/mojo/CommitMojoTest.java b/src/test/java/br/org/soujava/pomeditor/mojo/CommitMojoTest.java deleted file mode 100644 index f20b313..0000000 --- a/src/test/java/br/org/soujava/pomeditor/mojo/CommitMojoTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor.mojo; - -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugin.logging.Log; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; - -import java.nio.file.Path; -import java.util.function.Consumer; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.verify; - -@ExtendWith(MockitoExtension.class) -class CommitMojoTest { - - @Mock - Log log; - - @Mock - Consumer commitFunction; - - @Test - void execute() throws MojoExecutionException, MojoFailureException { - var mojo = new CommitMojo(); - mojo.setLog(log); - mojo.commitFunction = this.commitFunction; - mojo.execute(); - verify(log, atLeast(2)).info(anyString()); - verify(commitFunction, atLeastOnce()).accept(any(Path.class)); - } -} \ No newline at end of file diff --git a/src/test/java/br/org/soujava/pomeditor/mojo/EditingMojoTest.java b/src/test/java/br/org/soujava/pomeditor/mojo/EditingMojoTest.java deleted file mode 100644 index d9b4464..0000000 --- a/src/test/java/br/org/soujava/pomeditor/mojo/EditingMojoTest.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2024 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor.mojo; - - -import org.apache.maven.plugin.logging.Log; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardCopyOption; -import java.util.Arrays; -import java.util.Optional; -import java.util.function.Consumer; -import java.util.function.Function; - -import static org.mockito.Mockito.mock; - -@ExtendWith(MockitoExtension.class) -abstract class EditingMojoTest { - - @Mock - Log log; - - @Mock - Function backupFunction; - - @Mock - Consumer rollbackFunction; - - @Captor - ArgumentCaptor targetPom; - - Path tempDir; - Path pom; - - @BeforeEach - void createTempDirAndPom() throws IOException { - this.tempDir = Files.createTempDirectory(null); - this.log = mock(Log.class); - this.pom = newDummyPom(); - } - - private Path newDummyPom() throws IOException { - Path pom = Files.createTempFile(tempDir, "pom", ".xml"); - Files.copy(Path.of("pom.xml"), pom, StandardCopyOption.REPLACE_EXISTING); - return pom; - } - - @AfterEach - void destroyTempDir() { - Optional.ofNullable(tempDir).ifPresent(tempDir -> delete(tempDir.toFile())); - } - - void delete(File file) { - if (file.isDirectory()) { - Arrays.stream(file.listFiles()).forEach(this::delete); - } - file.delete(); - } -} diff --git a/src/test/java/br/org/soujava/pomeditor/mojo/GreetingMojoTest.java b/src/test/java/br/org/soujava/pomeditor/mojo/GreetingMojoTest.java deleted file mode 100644 index 4b89b56..0000000 --- a/src/test/java/br/org/soujava/pomeditor/mojo/GreetingMojoTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor.mojo; - -import br.org.soujava.pomeditor.mojo.GreetingMojo; -import org.apache.maven.plugin.logging.Log; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.verify; - -@ExtendWith(MockitoExtension.class) -class GreetingMojoTest { - - @Mock - Log logger; - - @Captor - ArgumentCaptor output; - - @Test - void shouldExecuteWithNoErrors() { - GreetingMojo mojo = newMojo(); - mojo.username = "Max"; - mojo.execute(); - verify(logger, atLeastOnce()).info(output.capture()); - assertEquals("Hi, Max!", output.getValue()); - } - - private GreetingMojo newMojo() { - GreetingMojo mojo = new GreetingMojo(); - mojo.setLog(logger); - return mojo; - } - -} \ No newline at end of file diff --git a/src/test/java/br/org/soujava/pomeditor/mojo/RollbackMojoTest.java b/src/test/java/br/org/soujava/pomeditor/mojo/RollbackMojoTest.java deleted file mode 100644 index 8f8a787..0000000 --- a/src/test/java/br/org/soujava/pomeditor/mojo/RollbackMojoTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package br.org.soujava.pomeditor.mojo; - -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugin.logging.Log; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; - -import java.nio.file.Path; -import java.util.function.Consumer; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.verify; - -@ExtendWith(MockitoExtension.class) -class RollbackMojoTest { - - @Mock - Log log; - - @Mock - Consumer rollbackFunction; - - @Test - void execute() throws MojoExecutionException, MojoFailureException { - var mojo = new RollbackMojo(); - mojo.setLog(log); - mojo.rollbackFunction = this.rollbackFunction; - mojo.execute(); - verify(log,atLeast(2)).info(anyString()); - verify(rollbackFunction, atLeast(1)).accept(any(Path.class)); - } -} \ No newline at end of file diff --git a/src/test/resources-its/br/org/soujava/pomeditor/it/AddDependencyMojoIT/has_dependency_already/pom.xml b/src/test/resources-its/br/org/soujava/pomeditor/it/AddDependencyMojoIT/has_dependency_already/pom.xml deleted file mode 100644 index dd15cd3..0000000 --- a/src/test/resources-its/br/org/soujava/pomeditor/it/AddDependencyMojoIT/has_dependency_already/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - 4.0.0 - - io.github.arrudalabs - test - 0.0.1-SNAPSHOT - pom - - - - org.junit.jupiter - junit-jupiter - 5.9.0 - - - - \ No newline at end of file diff --git a/src/test/resources-its/br/org/soujava/pomeditor/it/AddDependencyMojoIT/has_dependency_but_with_version_higher/pom.xml b/src/test/resources-its/br/org/soujava/pomeditor/it/AddDependencyMojoIT/has_dependency_but_with_version_higher/pom.xml deleted file mode 100644 index 1febed0..0000000 --- a/src/test/resources-its/br/org/soujava/pomeditor/it/AddDependencyMojoIT/has_dependency_but_with_version_higher/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - 4.0.0 - - io.github.arrudalabs - test - 0.0.1-SNAPSHOT - pom - - - - org.apache.maven.plugins - maven-clean-plugin - 3.2.0 - - - org.junit.jupiter - junit-jupiter - 5.9.1 - - - - \ No newline at end of file diff --git a/src/test/resources-its/br/org/soujava/pomeditor/it/AddDependencyMojoIT/has_dependency_but_with_version_lower/pom.xml b/src/test/resources-its/br/org/soujava/pomeditor/it/AddDependencyMojoIT/has_dependency_but_with_version_lower/pom.xml deleted file mode 100644 index 7050393..0000000 --- a/src/test/resources-its/br/org/soujava/pomeditor/it/AddDependencyMojoIT/has_dependency_but_with_version_lower/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - 4.0.0 - - io.github.arrudalabs - test - 0.0.1-SNAPSHOT - pom - - - - org.apache.maven.plugins - maven-clean-plugin - 3.2.0 - - - org.junit.jupiter - junit-jupiter - 5.7.0 - - - - \ No newline at end of file diff --git a/src/test/resources-its/br/org/soujava/pomeditor/it/AddDependencyMojoIT/no_dependencies_declarated/pom.xml b/src/test/resources-its/br/org/soujava/pomeditor/it/AddDependencyMojoIT/no_dependencies_declarated/pom.xml deleted file mode 100644 index 0b8193d..0000000 --- a/src/test/resources-its/br/org/soujava/pomeditor/it/AddDependencyMojoIT/no_dependencies_declarated/pom.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - 4.0.0 - - io.github.arrudalabs - test - 0.0.1-SNAPSHOT - pom - - \ No newline at end of file diff --git a/src/test/resources-its/br/org/soujava/pomeditor/it/AddDependencyMojoIT/with_other_dependencies/pom.xml b/src/test/resources-its/br/org/soujava/pomeditor/it/AddDependencyMojoIT/with_other_dependencies/pom.xml deleted file mode 100644 index 36a082e..0000000 --- a/src/test/resources-its/br/org/soujava/pomeditor/it/AddDependencyMojoIT/with_other_dependencies/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - 4.0.0 - - io.github.arrudalabs - test - 0.0.1-SNAPSHOT - pom - - - - org.apache.maven.plugins - maven-clean-plugin - 3.2.0 - - - \ No newline at end of file diff --git a/src/test/resources-its/br/org/soujava/pomeditor/it/ChangePropertyMojoIT/had_different_property/pom.xml b/src/test/resources-its/br/org/soujava/pomeditor/it/ChangePropertyMojoIT/had_different_property/pom.xml deleted file mode 100644 index 41ff412..0000000 --- a/src/test/resources-its/br/org/soujava/pomeditor/it/ChangePropertyMojoIT/had_different_property/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - 4.0.0 - - io.github.arrudalabs - test - 0.0.1-SNAPSHOT - pom - - - - org.junit.jupiter - junit-jupiter - 5.9.0 - - - - - is not a thing - i do not change - - - \ No newline at end of file diff --git a/src/test/resources-its/br/org/soujava/pomeditor/it/ChangePropertyMojoIT/had_no_properties/pom.xml b/src/test/resources-its/br/org/soujava/pomeditor/it/ChangePropertyMojoIT/had_no_properties/pom.xml deleted file mode 100644 index aa18c14..0000000 --- a/src/test/resources-its/br/org/soujava/pomeditor/it/ChangePropertyMojoIT/had_no_properties/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - 4.0.0 - - io.github.arrudalabs - test - 0.0.1-SNAPSHOT - pom - - - - org.junit.jupiter - junit-jupiter - 5.9.0 - - - - \ No newline at end of file diff --git a/src/test/resources-its/br/org/soujava/pomeditor/it/ChangePropertyMojoIT/had_no_property/pom.xml b/src/test/resources-its/br/org/soujava/pomeditor/it/ChangePropertyMojoIT/had_no_property/pom.xml deleted file mode 100644 index e654554..0000000 --- a/src/test/resources-its/br/org/soujava/pomeditor/it/ChangePropertyMojoIT/had_no_property/pom.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - 4.0.0 - - io.github.arrudalabs - test - 0.0.1-SNAPSHOT - pom - - - - org.junit.jupiter - junit-jupiter - 5.9.0 - - - - - i-am - - - \ No newline at end of file diff --git a/src/test/resources-its/br/org/soujava/pomeditor/it/ChangePropertyMojoIT/had_same_property/pom.xml b/src/test/resources-its/br/org/soujava/pomeditor/it/ChangePropertyMojoIT/had_same_property/pom.xml deleted file mode 100644 index 06c5591..0000000 --- a/src/test/resources-its/br/org/soujava/pomeditor/it/ChangePropertyMojoIT/had_same_property/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - 4.0.0 - - io.github.arrudalabs - test - 0.0.1-SNAPSHOT - pom - - - - org.junit.jupiter - junit-jupiter - 5.9.0 - - - - - principal - else - - - \ No newline at end of file diff --git a/src/test/resources-its/br/org/soujava/pomeditor/it/CommitMojoIT/project_with_backup/pom.xml b/src/test/resources-its/br/org/soujava/pomeditor/it/CommitMojoIT/project_with_backup/pom.xml deleted file mode 100644 index 0b8193d..0000000 --- a/src/test/resources-its/br/org/soujava/pomeditor/it/CommitMojoIT/project_with_backup/pom.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - 4.0.0 - - io.github.arrudalabs - test - 0.0.1-SNAPSHOT - pom - - \ No newline at end of file diff --git a/src/test/resources-its/br/org/soujava/pomeditor/it/CommitMojoIT/project_with_backup/pom.xml.backup b/src/test/resources-its/br/org/soujava/pomeditor/it/CommitMojoIT/project_with_backup/pom.xml.backup deleted file mode 100644 index dd15cd3..0000000 --- a/src/test/resources-its/br/org/soujava/pomeditor/it/CommitMojoIT/project_with_backup/pom.xml.backup +++ /dev/null @@ -1,34 +0,0 @@ - - - - 4.0.0 - - io.github.arrudalabs - test - 0.0.1-SNAPSHOT - pom - - - - org.junit.jupiter - junit-jupiter - 5.9.0 - - - - \ No newline at end of file diff --git a/src/test/resources-its/br/org/soujava/pomeditor/it/GreetingMojoIT/hello/pom.xml b/src/test/resources-its/br/org/soujava/pomeditor/it/GreetingMojoIT/hello/pom.xml deleted file mode 100644 index 0b8193d..0000000 --- a/src/test/resources-its/br/org/soujava/pomeditor/it/GreetingMojoIT/hello/pom.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - 4.0.0 - - io.github.arrudalabs - test - 0.0.1-SNAPSHOT - pom - - \ No newline at end of file diff --git a/src/test/resources-its/br/org/soujava/pomeditor/it/RemovePropertyMojoIT/had_no_properties/pom.xml b/src/test/resources-its/br/org/soujava/pomeditor/it/RemovePropertyMojoIT/had_no_properties/pom.xml deleted file mode 100644 index aa18c14..0000000 --- a/src/test/resources-its/br/org/soujava/pomeditor/it/RemovePropertyMojoIT/had_no_properties/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - 4.0.0 - - io.github.arrudalabs - test - 0.0.1-SNAPSHOT - pom - - - - org.junit.jupiter - junit-jupiter - 5.9.0 - - - - \ No newline at end of file diff --git a/src/test/resources-its/br/org/soujava/pomeditor/it/RemovePropertyMojoIT/had_no_property/pom.xml b/src/test/resources-its/br/org/soujava/pomeditor/it/RemovePropertyMojoIT/had_no_property/pom.xml deleted file mode 100644 index f82988b..0000000 --- a/src/test/resources-its/br/org/soujava/pomeditor/it/RemovePropertyMojoIT/had_no_property/pom.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - 4.0.0 - - io.github.arrudalabs - test - 0.0.1-SNAPSHOT - pom - - - - org.junit.jupiter - junit-jupiter - 5.9.0 - - - - - red - - - \ No newline at end of file diff --git a/src/test/resources-its/br/org/soujava/pomeditor/it/RemovePropertyMojoIT/property_removed/pom.xml b/src/test/resources-its/br/org/soujava/pomeditor/it/RemovePropertyMojoIT/property_removed/pom.xml deleted file mode 100644 index b8724e9..0000000 --- a/src/test/resources-its/br/org/soujava/pomeditor/it/RemovePropertyMojoIT/property_removed/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - 4.0.0 - - io.github.arrudalabs - test - 0.0.1-SNAPSHOT - pom - - - - org.junit.jupiter - junit-jupiter - 5.9.0 - - - - - green - i-must - - - \ No newline at end of file diff --git a/src/test/resources-its/br/org/soujava/pomeditor/it/RemovePropertyMojoIT/the_only_property_removed/pom.xml b/src/test/resources-its/br/org/soujava/pomeditor/it/RemovePropertyMojoIT/the_only_property_removed/pom.xml deleted file mode 100644 index 90201cc..0000000 --- a/src/test/resources-its/br/org/soujava/pomeditor/it/RemovePropertyMojoIT/the_only_property_removed/pom.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - 4.0.0 - - io.github.arrudalabs - test - 0.0.1-SNAPSHOT - pom - - - - org.junit.jupiter - junit-jupiter - 5.9.0 - - - - - i-must - - - \ No newline at end of file diff --git a/src/test/resources-its/br/org/soujava/pomeditor/it/RollbackMojoIT/project_with_backup/pom.xml b/src/test/resources-its/br/org/soujava/pomeditor/it/RollbackMojoIT/project_with_backup/pom.xml deleted file mode 100644 index 0b8193d..0000000 --- a/src/test/resources-its/br/org/soujava/pomeditor/it/RollbackMojoIT/project_with_backup/pom.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - 4.0.0 - - io.github.arrudalabs - test - 0.0.1-SNAPSHOT - pom - - \ No newline at end of file diff --git a/src/test/resources-its/br/org/soujava/pomeditor/it/RollbackMojoIT/project_with_backup/pom.xml.backup b/src/test/resources-its/br/org/soujava/pomeditor/it/RollbackMojoIT/project_with_backup/pom.xml.backup deleted file mode 100644 index dd15cd3..0000000 --- a/src/test/resources-its/br/org/soujava/pomeditor/it/RollbackMojoIT/project_with_backup/pom.xml.backup +++ /dev/null @@ -1,34 +0,0 @@ - - - - 4.0.0 - - io.github.arrudalabs - test - 0.0.1-SNAPSHOT - pom - - - - org.junit.jupiter - junit-jupiter - 5.9.0 - - - - \ No newline at end of file