You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Automatically exclude vaadin-dev-server from the production build #15749
vaadin-dev-server contains development time dependencies that are never needed in production. Some of them are quite large.
Describe the solution you'd like
When building for production, mvn clean install -Pproduction the resulting jar (Spring boot) or war (others) should not contain vaadin-dev-server or its dependencies
One way we could do this is to add a vaadin-dev platform level dependency and move vaadin-dev-server + vaadin-dev-bundle and potentially others there from vaadin-core. Then we need to change add the vaadin-dev dependency to each project like
one concern about the activeByDefault, as i read this from maven doc
All profiles that are active by default are automatically deactivated when a profile in the POM is activated on the command line or through its activation config.
so keep this as the only profile in the pom will work??
@Artur- Imho the solution to exclude the dependency in the production profile is the more better solution, also due to the issue raised by @ZheSun88.
As for Gradle, I don't have a solution at hand, but I'm fairly certain that it will be quite easy to achieve the same exclude behavior when the production profile is active. Probably worth reaching out to the maintainers of the Vaadin Gradle plugin.
You are right, it would be better to have an explicit include of the dev deps than an exclude. One option could be to use a profile that is only active when production is not active instead of using activeByDefault, like !production. But this might cause issues with other profiles like test...
In any case, the exclude is already better than the current situation ;)
I'm also +1 for the exclusion in the production profile. This could also be added to the projects created with start.vaadin.com and mentioned as recommendation in the 24.0 platform release.
Activity
Artur- commentedon Jan 27, 2023
One way we could do this is to add a
vaadin-devplatform level dependency and movevaadin-dev-server+vaadin-dev-bundleand potentially others there fromvaadin-core. Then we need to change add thevaadin-devdependency to each project likeArtur- commentedon Jan 27, 2023
Not sure how easy this is to apply on Gradle projects
ZheSun88 commentedon Jan 27, 2023
one concern about the
activeByDefault, as i read this from maven docso keep this as the only profile in the pom will work??
Artur- commentedon Jan 27, 2023
The other option I can come up with is that
vaadinincludesvaadin-devand we change the production profile to includebwolff commentedon Jan 27, 2023
@Artur- Imho the solution to exclude the dependency in the
productionprofile is the more better solution, also due to the issue raised by @ZheSun88.As for Gradle, I don't have a solution at hand, but I'm fairly certain that it will be quite easy to achieve the same exclude behavior when the
productionprofile is active. Probably worth reaching out to the maintainers of the Vaadin Gradle plugin.Artur- commentedon Jan 27, 2023
I agree. Excluding it is kind of backwards compared to including only when needed, but it is still a better solution
bwolff commentedon Jan 27, 2023
You are right, it would be better to have an explicit include of the dev deps than an exclude. One option could be to use a profile that is only active when production is not active instead of using
activeByDefault, like!production. But this might cause issues with other profiles liketest...In any case, the exclude is already better than the current situation ;)
mvysny commentedon Jan 27, 2023
In Gradle, I can conditionally exclude an artifact in my project's
build.gradle:This seems to be working well: neither
vaadin-dev-servernor its transitive dependencies are present in the zip, reducing the zip file size by ~8MB.Perhaps the same piece of code could be executed by the Gradle plugin automatically.
Attaching the dependency tree of
vaadin-dev-serverfor reference:knoobie commentedon Jan 27, 2023
I'm also +1 for the exclusion in the production profile. This could also be added to the projects created with start.vaadin.com and mentioned as recommendation in the 24.0 platform release.
fix: Exclude development dependencies from production jar
fix: Exclude development dependencies from production jar
fix: Exclude development dependencies from production jar
fix: Exclude development dependencies from production jar (#955)
fix: Exclude development dependencies from production jar (#667)
Artur- commentedon Mar 10, 2023
The platform artifacts have been fixed for 24.0.0 and the exclusion added to starters