diff --git a/.config/checkstyle/checkstyle.xml b/.config/checkstyle/checkstyle.xml index a0d7f17..43b5290 100644 --- a/.config/checkstyle/checkstyle.xml +++ b/.config/checkstyle/checkstyle.xml @@ -52,6 +52,7 @@ + @@ -68,6 +69,11 @@ + + + + + @@ -93,7 +99,6 @@ - @@ -122,7 +127,13 @@ + + + + + + diff --git a/.config/pmd/ruleset.xml b/.config/pmd/ruleset.xml index 7a03f17..d51fbb5 100644 --- a/.config/pmd/ruleset.xml +++ b/.config/pmd/ruleset.xml @@ -10,16 +10,38 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -76,9 +98,6 @@ - - - @@ -114,17 +133,33 @@ + + + + + + + + + + + + + + + + - + @@ -159,4 +194,25 @@ + + + + Do not used native HTML! Use Vaadin layouts and components to create required structure. + If you are 100% sure that you escaped the value properly and you have no better options you can suppress this. + + 2 + + + + + + + + diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index c35bef1..14f3816 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,6 +1,7 @@ name: 🐞 Bug description: Create a bug report for something that is broken labels: [bug] +type: bug body: - type: markdown attributes: diff --git a/.github/ISSUE_TEMPLATE/enhancement.yml b/.github/ISSUE_TEMPLATE/enhancement.yml index 5737870..fbcc46a 100644 --- a/.github/ISSUE_TEMPLATE/enhancement.yml +++ b/.github/ISSUE_TEMPLATE/enhancement.yml @@ -1,6 +1,7 @@ name: ✨ Feature/Enhancement description: Suggest a new feature or enhancement labels: [enhancement] +type: feature body: - type: markdown attributes: diff --git a/.github/workflows/broken-links.yml b/.github/workflows/broken-links.yml index 8f98f1a..16a3f37 100644 --- a/.github/workflows/broken-links.yml +++ b/.github/workflows/broken-links.yml @@ -19,7 +19,7 @@ jobs: - name: Link Checker id: lychee - uses: lycheeverse/lychee-action@v2 + uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332 # v2 with: fail: false # Don't fail on broken links, create an issue instead @@ -38,7 +38,7 @@ jobs: - name: Create Issue From File if: env.lychee_exit_code != 0 - uses: peter-evans/create-issue-from-file@v5 + uses: peter-evans/create-issue-from-file@e8ef132d6df98ed982188e460ebb3b5d4ef3a9cd # v5 with: issue-number: ${{ steps.find-issue.outputs.number }} title: Link Checker Report diff --git a/.github/workflows/check-build.yml b/.github/workflows/check-build.yml index bd726cc..05c0e76 100644 --- a/.github/workflows/check-build.yml +++ b/.github/workflows/check-build.yml @@ -127,7 +127,4 @@ jobs: name: pmd-report if-no-files-found: ignore path: | - target/site/*.html - target/site/css/** - target/site/images/logos/maven-feather.png - target/site/images/external.png + target/reports/** diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8bd23e5..dd32352 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,7 +26,7 @@ jobs: cache: 'maven' - name: Build with Maven - run: ./mvnw -B clean package -Pproduction + run: ./mvnw -B clean package -Pproduction -T2C - name: Check for uncommited changes run: | @@ -64,7 +64,7 @@ jobs: run: | mvnwPath=$(readlink -f ./mvnw) modules=("") # root - modules+=($(grep -ozP '(?<=module>)[^<]+' 'pom.xml' | tr -d '\0')) + modules+=($(grep -oP '(?<=)[^<]+' 'pom.xml')) for i in "${modules[@]}" do echo "Processing $i/pom.xml" @@ -89,7 +89,7 @@ jobs: - name: Create Release id: create_release - uses: shogo82148/actions-create-release@v1 + uses: shogo82148/actions-create-release@e5f206451d4ace2da9916d01f1aef279997f8659 # v1 with: tag_name: v${{ steps.version.outputs.release }} release_name: v${{ steps.version.outputs.release }} @@ -124,22 +124,22 @@ jobs: git config --global user.name "GitHub Actions" git pull - - name: Set up JDK Apache Maven Central + - name: Set up JDK uses: actions/setup-java@v4 with: # running setup-java again overwrites the settings.xml java-version: '17' distribution: 'temurin' - server-id: ossrh + server-id: sonatype-central-portal server-username: MAVEN_CENTRAL_USERNAME server-password: MAVEN_CENTRAL_TOKEN gpg-passphrase: MAVEN_GPG_PASSPHRASE gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} - - name: Publish to Apache Maven Central - run: ../mvnw -B deploy -Possrh -DskipTests + - name: Publish to Central Portal + run: ../mvnw -B deploy -P publish-sonatype-central-portal -DskipTests env: - MAVEN_CENTRAL_USERNAME: ${{ secrets.S01_OSS_SONATYPE_MAVEN_USERNAME }} - MAVEN_CENTRAL_TOKEN: ${{ secrets.S01_OSS_SONATYPE_MAVEN_TOKEN }} + MAVEN_CENTRAL_USERNAME: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_USERNAME }} + MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_TOKEN }} MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} working-directory: ${{ env.PRIMARY_MAVEN_MODULE }} @@ -168,10 +168,11 @@ jobs: working-directory: ${{ env.PRIMARY_MAVEN_MODULE }} - name: Deploy to Github pages - uses: peaceiris/actions-gh-pages@v4 + uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./${{ env.PRIMARY_MAVEN_MODULE }}/target/site + force_orphan: true after-release: runs-on: ubuntu-latest @@ -190,7 +191,7 @@ jobs: run: | mvnwPath=$(readlink -f ./mvnw) modules=("") # root - modules+=($(grep -ozP '(?<=module>)[^<]+' 'pom.xml' | tr -d '\0')) + modules+=($(grep -oP '(?<=)[^<]+' 'pom.xml')) for i in "${modules[@]}" do echo "Processing $i/pom.xml" diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index c9d7ec7..dc67287 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -20,6 +20,6 @@ jobs: with: sparse-checkout: .github/labels.yml - - uses: EndBug/label-sync@v2 + - uses: EndBug/label-sync@52074158190acb45f3077f9099fea818aa43f97a # v2 with: config-file: .github/labels.yml diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index 03f5339..8a85891 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -13,21 +13,21 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up JDK OSSRH + - name: Set up JDK uses: actions/setup-java@v4 with: # running setup-java again overwrites the settings.xml distribution: 'temurin' java-version: '17' - server-id: ossrh + server-id: sonatype-central-portal server-username: MAVEN_CENTRAL_USERNAME server-password: MAVEN_CENTRAL_TOKEN gpg-passphrase: MAVEN_GPG_PASSPHRASE gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} - - name: Publish to OSSRH - run: ../mvnw -B deploy -Possrh -DskipTests + - name: Publish to Central Portal + run: ../mvnw -B deploy -P publish-sonatype-central-portal -DskipTests working-directory: ${{ env.PRIMARY_MAVEN_MODULE }} env: - MAVEN_CENTRAL_USERNAME: ${{ secrets.S01_OSS_SONATYPE_MAVEN_USERNAME }} - MAVEN_CENTRAL_TOKEN: ${{ secrets.S01_OSS_SONATYPE_MAVEN_TOKEN }} + MAVEN_CENTRAL_USERNAME: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_USERNAME }} + MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_TOKEN }} MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} diff --git a/.github/workflows/update-from-template.yml b/.github/workflows/update-from-template.yml index 905a123..bfa8ac9 100644 --- a/.github/workflows/update-from-template.yml +++ b/.github/workflows/update-from-template.yml @@ -202,7 +202,7 @@ jobs: GH_TOKEN: ${{ secrets.UPDATE_FROM_TEMPLATE_PAT }} run: | not_failed_conclusion="skipped|neutral|success" - not_relevant_app_slug="dependabot|github-pages|sonarcloud" + not_relevant_app_slug="dependabot|github-pages|sonarqubecloud" echo "Waiting for checks to start..." sleep 40s @@ -212,7 +212,7 @@ jobs: echo "Checking if update-branch-merged exists" git fetch - if [[ $(git rev-parse origin/${{ env.UPDATE_BRANCH_MERGED }}) ]]; then + if [[ $(git ls-remote --heads origin refs/heads/${{ env.UPDATE_BRANCH_MERGED }}) ]]; then echo "Branch still exists; Continuing..." else echo "Branch origin/${{ env.UPDATE_BRANCH_MERGED }} is missing" diff --git a/.gitignore b/.gitignore index 41570f9..8ffb470 100644 --- a/.gitignore +++ b/.gitignore @@ -94,6 +94,7 @@ vite.generated.ts .idea/* !.idea/saveactions_settings.xml !.idea/checkstyle-idea.xml +!.idea/externalDependencies.xml !.idea/inspectionProfiles/ .idea/inspectionProfiles/* diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml index 5f35e01..b52c3e2 100644 --- a/.idea/checkstyle-idea.xml +++ b/.idea/checkstyle-idea.xml @@ -1,7 +1,7 @@ - 10.20.1 + 10.21.0 JavaOnlyWithTests true true diff --git a/.idea/externalDependencies.xml b/.idea/externalDependencies.xml new file mode 100644 index 0000000..78be5b8 --- /dev/null +++ b/.idea/externalDependencies.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 01785a7..2e237fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 1.0.2 +* Migrated deployment to _Sonatype Maven Central Portal_ [#155](https://github.com/xdev-software/standard-maven-template/issues/155) +* Updated dependencies + # 1.0.1 * Added customization degree * Makes it possible that certain filters or parts of them are read-only diff --git a/README.md b/README.md index 187f32c..549ab3c 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,9 @@ A description how to get it running can be found [below](#run-the-demo). | --- | --- | | Vaadin 24+ (latest) | ``1+`` | +### Spring-Boot +* You may have to include ``software/xdev`` inside [``vaadin.allowed-packages``](https://vaadin.com/docs/latest/integrations/spring/configuration#configure-the-scanning-of-packages) + ## Run the Demo * Checkout the repo * Run ``mvn install && mvn -f vaadin-simple-grid-filter-demo spring-boot:run`` diff --git a/pom.xml b/pom.xml index 8e9a22f..b2df0d5 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ - Apache License, Version 2.0 + Apache-2.0 https://www.apache.org/licenses/LICENSE-2.0.txt repo @@ -45,7 +45,7 @@ com.puppycrawl.tools checkstyle - 10.21.0 + 10.23.1 @@ -82,12 +82,12 @@ net.sourceforge.pmd pmd-core - 7.8.0 + 7.13.0 net.sourceforge.pmd pmd-java - 7.8.0 + 7.13.0 diff --git a/vaadin-simple-grid-filter-demo/pom.xml b/vaadin-simple-grid-filter-demo/pom.xml index 3328129..ae99c41 100644 --- a/vaadin-simple-grid-filter-demo/pom.xml +++ b/vaadin-simple-grid-filter-demo/pom.xml @@ -29,9 +29,9 @@ software.xdev.vaadin.Application - 24.6.0 + 24.7.4 - 3.4.0 + 3.4.5 @@ -126,7 +126,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.13.0 + 3.14.0 ${maven.compiler.release} diff --git a/vaadin-simple-grid-filter-demo/src/main/java/software/xdev/vaadin/Application.java b/vaadin-simple-grid-filter-demo/src/main/java/software/xdev/vaadin/Application.java index f5a4d96..32833af 100644 --- a/vaadin-simple-grid-filter-demo/src/main/java/software/xdev/vaadin/Application.java +++ b/vaadin-simple-grid-filter-demo/src/main/java/software/xdev/vaadin/Application.java @@ -9,6 +9,7 @@ import com.vaadin.flow.spring.annotation.EnableVaadin; +@SuppressWarnings({"checkstyle:HideUtilityClassConstructor", "PMD.UseUtilityClass"}) @SpringBootApplication @EnableVaadin @Push diff --git a/vaadin-simple-grid-filter-demo/src/main/resources/application.yml b/vaadin-simple-grid-filter-demo/src/main/resources/application.yml index b336051..9ef9e9d 100644 --- a/vaadin-simple-grid-filter-demo/src/main/resources/application.yml +++ b/vaadin-simple-grid-filter-demo/src/main/resources/application.yml @@ -1,5 +1,8 @@ vaadin: allowed-packages: software/xdev,com/vaadin/flow + devmode: + usageStatistics: + enabled: false spring: devtools: diff --git a/vaadin-simple-grid-filter/pom.xml b/vaadin-simple-grid-filter/pom.xml index c2c8174..4ec6f8e 100644 --- a/vaadin-simple-grid-filter/pom.xml +++ b/vaadin-simple-grid-filter/pom.xml @@ -35,7 +35,7 @@ - Apache License, Version 2.0 + Apache-2.0 https://www.apache.org/licenses/LICENSE-2.0.txt repo @@ -49,7 +49,7 @@ UTF-8 - 24.5.8 + 24.7.4 @@ -64,41 +64,6 @@ - - - - central - https://repo.maven.apache.org/maven2 - - false - - - - - - - - central - https://repo.maven.apache.org/maven2 - - false - - - - - - - ossrh - https://s01.oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ - - - com.vaadin @@ -122,7 +87,7 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 3.8.0 + 3.9.0 @@ -130,7 +95,7 @@ com.mycila license-maven-plugin - 4.6 + 5.0.0 ${project.organization.url} @@ -174,7 +139,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.13.0 + 3.14.0 ${maven.compiler.release} @@ -242,13 +207,13 @@ - ossrh + publish-sonatype-central-portal org.codehaus.mojo flatten-maven-plugin - 1.6.0 + 1.7.0 ossrh @@ -286,16 +251,13 @@ - org.sonatype.plugins - nexus-staging-maven-plugin - 1.7.0 + org.sonatype.central + central-publishing-maven-plugin + 0.7.0 true - ossrh - https://s01.oss.sonatype.org/ - - 30 - true + sonatype-central-portal + true @@ -313,7 +275,7 @@ com.puppycrawl.tools checkstyle - 10.21.0 + 10.23.1 @@ -350,12 +312,12 @@ net.sourceforge.pmd pmd-core - 7.8.0 + 7.13.0 net.sourceforge.pmd pmd-java - 7.8.0 + 7.13.0 diff --git a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java index 04a30b9..7581aa8 100644 --- a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java +++ b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/FilterComponent.java @@ -260,9 +260,9 @@ private void onOperatorChanged() // Change to a text field if the field is of type enum with condition 'contains' if(isSelSearchQueryVisible - && this.selOperations.getValue() - .getDescription() - .equals(ContainsComparator.CONTAINS_COMPARATOR_DESCRIPTION)) + && ContainsComparator.CONTAINS_COMPARATOR_DESCRIPTION.equals( + this.selOperations.getValue() + .getDescription())) { this.selSearchQuery.setVisible(false); this.txtSearchQuery.setVisible(true); @@ -405,7 +405,7 @@ private void onAcceptFilter() if(!this.identifier.isBlank()) { - if(this.editingBadgeId != null && !this.editingBadgeId.equals(NO_BADGE_ID_STRING)) + if(this.editingBadgeId != null && !NO_BADGE_ID_STRING.equals(this.editingBadgeId)) { badge.setBadgeId(this.editingBadgeId); this.editingBadgeId = null; @@ -447,7 +447,7 @@ private void onAcceptFilter() badge.setBtnEditEnabled(true); badge.addBtnEditClickListener(event -> { - if((this.hlFilter.getChildren().findAny().isEmpty())) + if(this.hlFilter.getChildren().findAny().isEmpty()) { // Add all components to the hlFilter layout this.onShowFilterInput(); @@ -514,7 +514,7 @@ private void deactivateDeleteButtonFromChipComponents( if(!this.identifier.isBlank() && badge.getBadgeId() != null - && !badge.getBadgeId().equals(NO_BADGE_ID_STRING)) + && !NO_BADGE_ID_STRING.equals(badge.getBadgeId())) { badge.setBadgeId(DELETED_INITIAL_CONDITION_STRING); this.addQueryParameter(badge); @@ -550,7 +550,7 @@ private void formatLocalDateChipBadgeText(final ChipBadge> final FilterCondition filterField = chipBadge.getItem(); if(this.dateRangePickerQuery.isVisible() - && filterField.getSelectedCondition().getDescription().equals(IS_BETWEEN_COMPARATOR_DESCRIPTION)) + && IS_BETWEEN_COMPARATOR_DESCRIPTION.equals(filterField.getSelectedCondition().getDescription())) { chipBadge.setItemLabelGenerator((ItemLabelGenerator>)tFilterCondition -> { @@ -896,7 +896,7 @@ private void createConditionsFromQueryParameters() && i < this.queryBadgeDeletableList.size() && i < this.queryBadgeEditableList.size()) { - if(!this.queryBadgeIdList.get(i).equals(DELETED_INITIAL_CONDITION_STRING)) + if(!DELETED_INITIAL_CONDITION_STRING.equals(this.queryBadgeIdList.get(i))) { final String badgeId = this.queryBadgeIdList.get(i); CustomizationDegree customizationDegree = CustomizationDegree.EVERYTHING; @@ -933,7 +933,7 @@ private void createConditionsFromQueryParameters() { // Check for same condition final FilterCondition item = chipBadge.getItem(); - if(!chipBadge.getBadgeId().equals(NO_BADGE_ID_STRING) + if(!NO_BADGE_ID_STRING.equals(chipBadge.getBadgeId()) && this.queryInputFieldList.get(i).equals(item.getInputValue()) && this.queryConditionFieldList.get(i) .equals(item.getSelectedCondition().getDescription()) @@ -1216,7 +1216,13 @@ public void beforeEnter(final BeforeEnterEvent beforeEnterEvent) .filter(i -> this.identifier.equals(idList.get(i))) .toArray(); - String componentId, field, condition, input, badgeId, editable, deletable; + String componentId; + String field; + String condition; + String input; + String badgeId; + String editable; + String deletable; for(final int i : matchingIndices) { diff --git a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/comparators/utl/TypeHelper.java b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/comparators/utl/TypeHelper.java index 29d8729..2e8ad54 100644 --- a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/comparators/utl/TypeHelper.java +++ b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/comparators/utl/TypeHelper.java @@ -46,7 +46,8 @@ public static boolean isDouble(final String str) return false; } } - + + @SuppressWarnings("PMD.UselessOperationOnImmutable") public static boolean isLocalDate(final String str) { Objects.requireNonNull(str); @@ -61,7 +62,8 @@ public static boolean isLocalDate(final String str) return false; } } - + + @SuppressWarnings("PMD.UselessOperationOnImmutable") public static boolean isLocalDateTime(final String str) { Objects.requireNonNull(str); diff --git a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/utl/QueryParameterUtil.java b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/utl/QueryParameterUtil.java index fe8298f..47a2602 100644 --- a/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/utl/QueryParameterUtil.java +++ b/vaadin-simple-grid-filter/src/main/java/software/xdev/vaadin/utl/QueryParameterUtil.java @@ -20,6 +20,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; import com.vaadin.flow.router.QueryParameters; @@ -67,17 +68,19 @@ && isNotNullOrEmpty(inputList) && idList.size() == conditionList.size() && idList.size() == inputList.size()) { + final Set parametersToCheck = Set.of( + QUERY_INPUT_STRING, + QUERY_COMPONENT_ID_STRING, + QUERY_FIELD_STRING, + QUERY_CONDITION_STRING, + QUERY_BADGE_ID_STRING, + QUERY_BADGE_EDITABLE_STRING, + QUERY_BADGE_DELETABLE_STRING); for(final Map.Entry> entry : parametersMap.entrySet()) { // Conditions and fields cannot be null or empty - if(entry.getKey().equals(QUERY_INPUT_STRING) - || ((entry.getKey().equals(QUERY_COMPONENT_ID_STRING) - || entry.getKey().equals(QUERY_FIELD_STRING) - || entry.getKey().equals(QUERY_CONDITION_STRING) - || entry.getKey().equals(QUERY_BADGE_ID_STRING) - || entry.getKey().equals(QUERY_BADGE_EDITABLE_STRING) - || entry.getKey().equals(QUERY_BADGE_DELETABLE_STRING)) - && entry.getValue().stream().noneMatch(String::isBlank))) + if(parametersToCheck.contains(entry.getKey()) + && entry.getValue().stream().noneMatch(String::isBlank)) { rightParameters = true; }