Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
251594a
Improve caching and remove excessive whitespaces
AB-xdev Aug 28, 2025
3dfbb54
Remove excessive white-spaces
AB-xdev Aug 28, 2025
ae6bea8
Merge branch 'master' into update-from-template-merged
xdev-gh-bot Aug 28, 2025
e96287e
Merge branch 'master' into update-from-template-merged
xdev-gh-bot Aug 28, 2025
d820b9e
Enable pmd analysis cache
AB-xdev Aug 28, 2025
85ec706
Update dependency com.puppycrawl.tools:checkstyle to v11.0.1
xdev-renovate Sep 1, 2025
a9590eb
Merge pull request #194 from xdev-software/renovate/com.puppycrawl.to…
AB-xdev Sep 1, 2025
5b71018
Merge remote-tracking branch 'origin/update-from-template'
AB-xdev Sep 2, 2025
c41665b
PMD: AvoidUnmanagedThreads
AB-xdev Sep 2, 2025
3b31f0b
Fix format
AB-xdev Sep 2, 2025
ebe579f
PMD: Add PostConstruct and PreDestroy
AB-xdev Sep 2, 2025
3792ace
Merge branch 'master' into update-from-template-merged
xdev-gh-bot Sep 2, 2025
1b5e5fe
Merge branch 'master' into update-from-template-merged
xdev-gh-bot Sep 2, 2025
d23faec
Init
AB-xdev Sep 3, 2025
b967a6a
Merge remote-tracking branch 'origin/update-from-template-xdev-softwa…
AB-xdev Sep 3, 2025
a42d3cb
Merge branch 'master' into update-from-template-xdev-software/java-te…
xdev-gh-bot Sep 3, 2025
a5ba0be
Merge branch 'master' into update-from-template-xdev-software/standar…
xdev-gh-bot Sep 3, 2025
bba9aa6
No EoL
AB-xdev Sep 3, 2025
dc3ac3d
Merge branch 'master' into update-from-template-xdev-software/java-se…
xdev-gh-bot Sep 3, 2025
1931201
Merge branch 'master' into update-from-template-xdev-software/java-te…
xdev-gh-bot Sep 3, 2025
44bfac8
Merge branch 'master' into update-from-template-xdev-software/standar…
xdev-gh-bot Sep 3, 2025
d8ffa2a
Merge branch 'develop' into update-from-template-merged
xdev-gh-bot Sep 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .config/pmd/java/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,71 @@
</properties>
</rule>

<rule name="AvoidPostConstruct"
language="java"
message="Avoid @PostConstruct"
class="net.sourceforge.pmd.lang.rule.xpath.XPathRule">
<description>
Using a `@PostConstruct` method is usually only done when field injection is used and initialization needs to be performed after that.

It's better to do this directly in the constructor with constructor injection, so that all logic will be encapsulated there.
This also makes using the bean in environments where JavaEE is not present - for example in tests - a lot easier, as forgetting to call the `@PostConstruct` method is no longer possible.
</description>
<priority>3</priority>
<properties>
<property name="xpath">
<value>
<![CDATA[
//MethodDeclaration[pmd-java:hasAnnotation('jakarta.annotation.PostConstruct')]
]]>
</value>
</property>
</properties>
</rule>

<rule name="AvoidPreDestroy"
language="java"
message="Avoid @PreDestroy"
class="net.sourceforge.pmd.lang.rule.xpath.XPathRule">
<description>
`@PreDestroy` should be replaced by implementing `AutoCloseable` and overwriting the `close` method instead.

This also makes using the bean in environments where JavaEE is not present - for example in tests - a lot easier, as forgetting to call the `@PreDestroy` method is no much more difficult.
</description>
<priority>3</priority>
<properties>
<property name="xpath">
<value>
<![CDATA[
//MethodDeclaration[pmd-java:hasAnnotation('jakarta.annotation.PreDestroy')]
]]>
</value>
</property>
</properties>
</rule>

<rule name="AvoidUnmanagedThreads"
language="java"
message="Avoid unmanaged threads"
class="net.sourceforge.pmd.lang.rule.xpath.XPathRule">
<description>
Trying to manually manage threads usually gets quickly out of control and may result in various problems like uncontrollable spawning of threads.
Threads can also not be cancelled properly.

Use managed Thread services like `ExecutorService` and `CompletableFuture` instead.
</description>
<priority>3</priority>
<properties>
<property name="xpath">
<value>
<![CDATA[
//MethodCall[pmd-java:matchesSig('java.lang.Thread#start()') or pmd-java:matchesSig('java.lang.Thread#startVirtualThread(java.lang.Runnable)') or pmd-java:matchesSig('java.lang.Thread$Builder#start(java.lang.Runnable)')]
]]>
</value>
</property>
</properties>
</rule>

<rule name="JavaObjectSerializationIsUnsafe"
language="java"
message="Using Java Object (De-)Serialization is unsafe and has led to too many security vulnerabilities"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/broken-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
echo "number=$(gh issue list -l 'bug' -l 'automated' -L 1 -S 'in:title \"Link Checker Report\"' -s 'open' --json 'number' --jq '.[].number')" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ github.token }}

- name: Close issue if everything is fine
if: steps.lychee.outputs.exit_code == 0 && steps.find-issue.outputs.number != ''
run: gh issue close -r 'not planned' ${{ steps.find-issue.outputs.number }}
Expand Down
61 changes: 46 additions & 15 deletions .github/workflows/check-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,27 @@ jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30

strategy:
matrix:
java: [17, 21]
distribution: [temurin]

steps:
- uses: actions/checkout@v5

- name: Set up JDK
uses: actions/setup-java@v5
with:
distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }}
cache: 'maven'


- name: Cache Maven
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-mvn-build-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-mvn-build-

- name: Cache Vaadin prod bundles
uses: actions/cache@v4
with:
Expand All @@ -50,10 +55,10 @@ jobs:
key: ${{ runner.os }}-vaadin-prod-bundles-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-vaadin-prod-bundles-

- name: Build with Maven
run: ./mvnw -B clean package -Pproduction
run: ./mvnw -B clean package

- name: Check for uncommited changes
run: |
if [[ "$(git status --porcelain)" != "" ]]; then
Expand Down Expand Up @@ -83,21 +88,34 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
timeout-minutes: 15

strategy:
matrix:
java: [17]
distribution: [temurin]

steps:
- uses: actions/checkout@v5

- name: Set up JDK
uses: actions/setup-java@v5
with:
distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }}
cache: 'maven'

- name: Cache Maven
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-mvn-checkstyle-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-mvn-checkstyle-

- name: CheckStyle Cache
uses: actions/cache@v4
with:
path: '**/target/checkstyle-cachefile'
key: ${{ runner.os }}-checkstyle-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-checkstyle-

- name: Run Checkstyle
run: ./mvnw -B checkstyle:check -P checkstyle -T2C
Expand All @@ -106,12 +124,10 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
timeout-minutes: 15

strategy:
matrix:
java: [17]
distribution: [temurin]

steps:
- uses: actions/checkout@v5

Expand All @@ -120,7 +136,22 @@ jobs:
with:
distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }}
cache: 'maven'

- name: Cache Maven
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-mvn-pmd-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-mvn-pmd-

- name: PMD Cache
uses: actions/cache@v4
with:
path: '**/target/pmd/pmd.cache'
key: ${{ runner.os }}-pmd-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-pmd-

- name: Run PMD
run: ./mvnw -B test pmd:aggregate-pmd-no-fork pmd:check -P pmd -DskipTests -T2C
Expand Down
46 changes: 32 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,30 @@ permissions:
contents: write
pull-requests: write

# DO NOT RESTORE CACHE for critical release steps to prevent a (extremely unlikely) scenario
# where a supply chain attack could be achieved due to poisoned cache
jobs:
check-code:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v5

- name: Set up JDK
uses: actions/setup-java@v5
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'


# Try to reuse existing cache from check-build
- name: Try restore Maven Cache
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-mvn-build-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-mvn-build-

- name: Build with Maven
run: ./mvnw -B clean package -Pproduction -T2C

Expand Down Expand Up @@ -54,31 +64,31 @@ jobs:
upload_url: ${{ steps.create-release.outputs.upload_url }}
steps:
- uses: actions/checkout@v5

- name: Configure Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"

- name: Un-SNAP
run: ./mvnw -B versions:set -DremoveSnapshot -DprocessAllModules -DgenerateBackupPoms=false

- name: Get version
id: version
run: |
version=$(../mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "release=$version" >> $GITHUB_OUTPUT
echo "releasenumber=${version//[!0-9]/}" >> $GITHUB_OUTPUT
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}

- name: Commit and Push
run: |
git add -A
git commit -m "Release ${{ steps.version.outputs.release }}"
git push origin
git tag v${{ steps.version.outputs.release }}
git push origin --tags

- name: Create Release
id: create-release
uses: shogo82148/actions-create-release@4661dc54f7b4b564074e9fbf73884d960de569a3 # v1
Expand Down Expand Up @@ -109,7 +119,7 @@ jobs:
timeout-minutes: 60
steps:
- uses: actions/checkout@v5

- name: Init Git and pull
run: |
git config --global user.email "[email protected]"
Expand All @@ -125,7 +135,7 @@ jobs:
server-password: PACKAGES_CENTRAL_TOKEN
gpg-passphrase: MAVEN_GPG_PASSPHRASE
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Only import once

- name: Publish to GitHub Packages Central
run: ../mvnw -B deploy -P publish -DskipTests -DaltDeploymentRepository=github-central::https://maven.pkg.github.com/xdev-software/central
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
Expand Down Expand Up @@ -157,7 +167,7 @@ jobs:
timeout-minutes: 15
steps:
- uses: actions/checkout@v5

- name: Init Git and pull
run: |
git config --global user.email "[email protected]"
Expand All @@ -169,7 +179,15 @@ jobs:
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'

# Try to reuse existing cache from check-build
- name: Try restore Maven Cache
uses: actions/cache/restore@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-mvn-build-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-mvn-build-

- name: Build site
run: ../mvnw -B compile site -DskipTests -T2C
Expand All @@ -188,7 +206,7 @@ jobs:
timeout-minutes: 10
steps:
- uses: actions/checkout@v5

- name: Init Git and pull
run: |
git config --global user.email "[email protected]"
Expand All @@ -203,7 +221,7 @@ jobs:
git add -A
git commit -m "Preparing for next development iteration"
git push origin

- name: pull-request
env:
GH_TOKEN: ${{ github.token }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ jobs:
server-password: PACKAGES_CENTRAL_TOKEN
gpg-passphrase: MAVEN_GPG_PASSPHRASE
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Only import once

- name: Publish to GitHub Packages Central
run: ../mvnw -B deploy -P publish -DskipTests -DaltDeploymentRepository=github-central::https://maven.pkg.github.com/xdev-software/central
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
env:
PACKAGES_CENTRAL_TOKEN: ${{ secrets.PACKAGES_CENTRAL_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: Set up JDK
uses: actions/setup-java@v5
with: # running setup-java again overwrites the settings.xml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update-from-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
# If no PAT is used the following error occurs on a push:
# refusing to allow a GitHub App to create or update workflow `.github/workflows/xxx.yml` without `workflows` permission
token: ${{ secrets.UPDATE_FROM_TEMPLATE_PAT }}

- name: Init Git
run: |
git config --global user.email "[email protected]"
Expand Down Expand Up @@ -190,7 +190,7 @@ jobs:
# If no PAT is used the following error occurs on a push:
# refusing to allow a GitHub App to create or update workflow `.github/workflows/xxx.yml` without `workflows` permission
token: ${{ secrets.UPDATE_FROM_TEMPLATE_PAT }}

- name: Init Git
run: |
git config --global user.email "[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>11.0.0</version>
<version>11.0.1</version>
</dependency>
</dependencies>
<configuration>
Expand All @@ -72,6 +72,7 @@
<artifactId>maven-pmd-plugin</artifactId>
<version>3.27.0</version>
<configuration>
<analysisCache>true</analysisCache>
<includeTests>true</includeTests>
<printFailingErrors>true</printFailingErrors>
<rulesets>
Expand Down
Loading
Loading