feat: Improve license error for unoptimized bundle#24145
Merged
mcollovati merged 2 commits intomainfrom Apr 21, 2026
Merged
Conversation
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
d1a26aa to
716a835
Compare
…age_for_unoptimized_bundle
|
tltv
approved these changes
Apr 20, 2026
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



When
optimizeBundleis 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 thecom.vaadin:vaadinumbrella artifact directly or transitively.Detect the disabled
optimizeBundlecase inBuildFrontendUtil.validateLicensesand throw aLicenseExceptionwhose message explains the classpath-level detection and gives concrete workarounds: re-enableoptimizeBundle, replacecom.vaadin:vaadinwithcom.vaadin:vaadin-corewhen declared as a direct dependency, or identify and exclude the transitive pull viamvn dependency:tree/./gradlew dependencyInsight. A newvalidateLicenses(PluginAdapterBuild, ...)overload reads the flag; thePluginAdapterBaseoverload is deprecated and delegates to it.Fixes #24051