Skip to content

feat: Improve license error for unoptimized bundle#24145

Merged
mcollovati merged 2 commits intomainfrom
issues/24051-better_license_check_error_message_for_unoptimized_bundle
Apr 21, 2026
Merged

feat: Improve license error for unoptimized bundle#24145
mcollovati merged 2 commits intomainfrom
issues/24051-better_license_check_error_message_for_unoptimized_bundle

Conversation

@mcollovati
Copy link
Copy Markdown
Collaborator

When optimizeBundle is disabled the bytecode scanner is skipped and every commercial component on the classpath is treated as used, so the existing license error wrongly states "Your application contains the following commercial components" even when the application does not reference any of them. This is common for projects that pull the com.vaadin:vaadin umbrella artifact directly or transitively.

Detect the disabled optimizeBundle case in
BuildFrontendUtil.validateLicenses and throw a LicenseException whose message explains the classpath-level detection and gives concrete workarounds: re-enable optimizeBundle, replace com.vaadin:vaadin with com.vaadin:vaadin-core when declared as a direct dependency, or identify and exclude the transitive pull via mvn dependency:tree / ./gradlew dependencyInsight. A new validateLicenses(PluginAdapterBuild, ...) overload reads the flag; the PluginAdapterBase overload is deprecated and delegates to it.

Fixes #24051

@mcollovati mcollovati changed the title fix: Improve license error for unoptimized bundle feat: Improve license error for unoptimized bundle Apr 20, 2026
When `optimizeBundle` is disabled the bytecode scanner is skipped and
every commercial component on the classpath is treated as used, so the
existing license error wrongly states "Your application contains the
following commercial components" even when the application does not
reference any of them. This is common for projects that pull the
`com.vaadin:vaadin` umbrella artifact directly or transitively.

Detect the disabled `optimizeBundle` case in
`BuildFrontendUtil.validateLicenses` and throw a `LicenseException`
whose message explains the classpath-level detection and gives
concrete workarounds: re-enable `optimizeBundle`, replace
`com.vaadin:vaadin` with `com.vaadin:vaadin-core` when declared as a
direct dependency, or identify and exclude the transitive pull via
`mvn dependency:tree` / `./gradlew dependencyInsight`. A new
`validateLicenses(PluginAdapterBuild, ...)` overload reads the flag;
the `PluginAdapterBase` overload is deprecated and delegates to it.

Fixes #24051
@mcollovati mcollovati force-pushed the issues/24051-better_license_check_error_message_for_unoptimized_bundle branch from d1a26aa to 716a835 Compare April 20, 2026 08:39
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 20, 2026

Test Results

 1 391 files  ±0   1 391 suites  ±0   1h 15m 13s ⏱️ +16s
 9 999 tests +2   9 928 ✅ +2  71 💤 ±0  0 ❌ ±0 
10 474 runs  +2  10 394 ✅ +2  80 💤 ±0  0 ❌ ±0 

Results for commit 2cb5a9b. ± Comparison against base commit 0a924d4.

♻️ This comment has been updated with latest results.

@mshabarov mshabarov requested a review from tltv April 20, 2026 11:37
@sonarqubecloud
Copy link
Copy Markdown

@mcollovati mcollovati added this pull request to the merge queue Apr 21, 2026
Merged via the queue into main with commit 72a8e63 Apr 21, 2026
31 checks passed
@mcollovati mcollovati deleted the issues/24051-better_license_check_error_message_for_unoptimized_bundle branch April 21, 2026 08:13
vaadin-bot added a commit that referenced this pull request Apr 21, 2026
#24153)

This PR cherry-picks changes from the original PR #24145 to branch 25.1.
---
#### Original PR description
> When `optimizeBundle` is disabled the bytecode scanner is skipped and
every commercial component on the classpath is treated as used, so the
existing license error wrongly states "Your application contains the
following commercial components" even when the application does not
reference any of them. This is common for projects that pull the
`com.vaadin:vaadin` umbrella artifact directly or transitively.
> 
> Detect the disabled `optimizeBundle` case in
> `BuildFrontendUtil.validateLicenses` and throw a `LicenseException`
whose message explains the classpath-level detection and gives concrete
workarounds: re-enable `optimizeBundle`, replace `com.vaadin:vaadin`
with `com.vaadin:vaadin-core` when declared as a direct dependency, or
identify and exclude the transitive pull via `mvn dependency:tree` /
`./gradlew dependencyInsight`. A new
`validateLicenses(PluginAdapterBuild, ...)` overload reads the flag; the
`PluginAdapterBase` overload is deprecated and delegates to it.
> 
> Fixes #24051
>

Co-authored-by: Marco Collovati <marco@vaadin.com>
Co-authored-by: Mikhail Shabarov <61410877+mshabarov@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Confusing message when license checking fails due to unused components and optimizeBundle=false

4 participants