-
Notifications
You must be signed in to change notification settings - Fork 187
feat: allow skipping Vaadin maven plugin execution during a build #22516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mshabarov
merged 10 commits into
vaadin:main
from
jorgheymans:feature/add-vaadin-skip-parameter
Oct 20, 2025
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7789a5f
Add vaadin.skip parameter to bypass plugin execution
jorgheymans 14321f8
revert Clippy Claude things
jorgheymans e2d0f8f
Fix test
jorgheymans 9eb3095
fix maven version
jorgheymans 87c2e65
fix test compilation error
jorgheymans e7eaa41
use invoker to verify the build was skipped
jorgheymans d0f96bd
configure skip directly on the plugin instead of profile
jorgheymans eeafc83
typo
jorgheymans ad1ab21
better invoker command as suggested
jorgheymans 6f0165e
format
mcollovati File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
flow-plugins/flow-maven-plugin/src/it/vaadin-skip-test/invoker.properties
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# | ||
# Copyright 2000-2025 Vaadin Ltd. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
# | ||
|
||
invoker.goals=clean flow:prepare-frontend | ||
invoker.buildResult=success |
54 changes: 54 additions & 0 deletions
54
flow-plugins/flow-maven-plugin/src/it/vaadin-skip-test/pom.xml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.vaadin.test.maven</groupId> | ||
<artifactId>vaadin-skip-test</artifactId> | ||
<version>1.0</version> | ||
<packaging>jar</packaging> | ||
|
||
<description> | ||
Tests the vaadin.skip parameter functionality. | ||
</description> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.release>21</maven.compiler.release> | ||
<maven.compiler.source>${maven.compiler.release}</maven.compiler.source> | ||
<maven.compiler.target>${maven.compiler.release}</maven.compiler.target> | ||
<maven.test.skip>true</maven.test.skip> | ||
<flow.version>@project.version@</flow.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.vaadin</groupId> | ||
<artifactId>flow-server</artifactId> | ||
<version>${flow.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.vaadin</groupId> | ||
<artifactId>flow-client</artifactId> | ||
<version>${flow.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.13.0</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>com.vaadin</groupId> | ||
<artifactId>flow-maven-plugin</artifactId> | ||
<version>${flow.version}</version> | ||
<configuration> | ||
<skip>true</skip> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
9 changes: 9 additions & 0 deletions
9
...flow-maven-plugin/src/it/vaadin-skip-test/src/main/java/com/vaadin/test/SkipTestView.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.vaadin.test; | ||
|
||
import com.vaadin.flow.component.Component; | ||
import com.vaadin.flow.router.Route; | ||
|
||
@Route | ||
public class SkipTestView extends Component { | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
flow-plugins/flow-maven-plugin/src/it/vaadin-skip-test/verify.bsh
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import java.nio.file.*; | ||
|
||
flowTsx = basedir.toPath().resolve("build.log"); | ||
if ( !Files.exists(flowTsx, new LinkOption[0]) ) | ||
{ | ||
throw new RuntimeException("build.log not found"); | ||
} | ||
|
||
lines = Files.readString(flowTsx); | ||
if ( !lines.contains("Skipping Vaadin build") ) | ||
{ | ||
throw new RuntimeException("Vaadin build not skipped"); | ||
} |
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
87 changes: 87 additions & 0 deletions
87
...ugins/flow-maven-plugin/src/test/java/com/vaadin/flow/plugin/maven/SkipExecutionTest.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* | ||
* Copyright 2000-2025 Vaadin Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
package com.vaadin.flow.plugin.maven; | ||
|
||
import java.io.File; | ||
|
||
import org.apache.maven.plugin.logging.Log; | ||
import org.codehaus.plexus.util.ReflectionUtils; | ||
import org.junit.Before; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.TemporaryFolder; | ||
import org.mockito.Mockito; | ||
|
||
import static com.vaadin.flow.plugin.maven.BuildFrontendMojoTest.setProject; | ||
import static org.mockito.Mockito.never; | ||
import static org.mockito.Mockito.verify; | ||
|
||
public class SkipExecutionTest { | ||
|
||
@Rule | ||
public TemporaryFolder temporaryFolder = new TemporaryFolder(); | ||
|
||
private PrepareFrontendMojo mojo; | ||
private Log mockLog; | ||
private File projectBase; | ||
|
||
@Before | ||
public void setup() throws Exception { | ||
mojo = new PrepareFrontendMojo(); | ||
mockLog = Mockito.mock(Log.class); | ||
projectBase = temporaryFolder.getRoot(); | ||
|
||
// Set up the mojo with basic configuration | ||
ReflectionUtils.setVariableValueInObject(mojo, "projectBasedir", | ||
projectBase); | ||
ReflectionUtils.setVariableValueInObject(mojo, "frontendDirectory", | ||
new File(projectBase, "src/main/frontend")); | ||
|
||
setProject(mojo, projectBase); | ||
|
||
// Use reflection to set the mock logger | ||
ReflectionUtils.setVariableValueInObject(mojo, "log", mockLog); | ||
} | ||
|
||
@Test | ||
public void testSkipExecutionWhenVaadinSkipIsTrue() throws Exception { | ||
// Set the skip parameter to true | ||
ReflectionUtils.setVariableValueInObject(mojo, "skip", true); | ||
|
||
// Execute the mojo | ||
mojo.execute(); | ||
|
||
// Verify that the skip message was logged | ||
verify(mockLog).info("Skipping Vaadin build"); | ||
} | ||
|
||
@Test | ||
public void testNormalExecutionWhenVaadinSkipIsFalse() throws Exception { | ||
// Set the skip parameter to false (default) | ||
ReflectionUtils.setVariableValueInObject(mojo, "skip", false); | ||
|
||
try { | ||
// Execute the mojo - this might fail due to missing dependencies in | ||
// test env | ||
mojo.execute(); | ||
} catch (Exception e) { | ||
// Expected - we're just testing that skip message is not logged | ||
} | ||
|
||
// Verify that the skip message was NOT logged | ||
verify(mockLog, never()).info("Skipping Vaadin build"); | ||
} | ||
} |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.