Skip to content

Commit cc2f302

Browse files
committed
feat: support scanning configuration in maven plugin
Allows to fine tune scanning for frontend resources by defining inclusion and exclusion rules in the flow maven plugin configuration. Fixes #21052
1 parent 442b051 commit cc2f302

File tree

29 files changed

+2004
-73
lines changed

29 files changed

+2004
-73
lines changed

flow-plugins/flow-maven-plugin/src/it/flow-addon/invoker.properties

+2
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ invoker.goals=package
2121
invoker.profiles.1=
2222
invoker.profiles.2=fake-flow-resources
2323
invoker.profiles.3=fake-flow-plugin-resources
24+
invoker.profiles.4=alpha-addon
25+
invoker.profiles.5=beta-addon

flow-plugins/flow-maven-plugin/src/it/flow-addon/pom.xml

+51
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,31 @@
2121
<maven.compiler.source>${maven.compiler.release}</maven.compiler.source>
2222
<maven.compiler.target>${maven.compiler.release}</maven.compiler.target>
2323
<maven.test.skip>true</maven.test.skip>
24+
<custom.source.directory>src/main/java</custom.source.directory>
2425
</properties>
2526

27+
<build>
28+
<sourceDirectory>${custom.source.directory}</sourceDirectory>
29+
<plugins>
30+
<plugin>
31+
<groupId>org.apache.maven.plugins</groupId>
32+
<artifactId>maven-clean-plugin</artifactId>
33+
<executions>
34+
<execution>
35+
<id>clean-only-classes</id>
36+
<goals>
37+
<goal>clean</goal>
38+
</goals>
39+
<phase>initialize</phase>
40+
<configuration>
41+
<directory>${project.build.outputDirectory}</directory>
42+
</configuration>
43+
</execution>
44+
</executions>
45+
</plugin>
46+
</plugins>
47+
</build>
48+
2649
<dependencies>
2750
<dependency>
2851
<groupId>com.vaadin</groupId>
@@ -59,6 +82,34 @@
5982
</resources>
6083
</build>
6184
</profile>
85+
<profile>
86+
<id>alpha-addon</id>
87+
<properties>
88+
<custom.source.directory>src/main/alpha-addon/java</custom.source.directory>
89+
</properties>
90+
<build>
91+
<finalName>alpha-addon-${project.version}</finalName>
92+
<resources>
93+
<resource>
94+
<directory>${project.basedir}/src/main/alpha-addon/resources</directory>
95+
</resource>
96+
</resources>
97+
</build>
98+
</profile>
99+
<profile>
100+
<id>beta-addon</id>
101+
<properties>
102+
<custom.source.directory>src/main/beta-addon/java</custom.source.directory>
103+
</properties>
104+
<build>
105+
<finalName>beta-addon-${project.version}</finalName>
106+
<resources>
107+
<resource>
108+
<directory>${project.basedir}/src/main/beta-addon/resources</directory>
109+
</resource>
110+
</resources>
111+
</build>
112+
</profile>
62113
</profiles>
63114

64115
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright 2000-2025 Vaadin Ltd.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
17+
package com.vaadin.addon.alpha;
18+
19+
import com.vaadin.flow.component.Component;
20+
import com.vaadin.flow.component.Tag;
21+
import com.vaadin.flow.component.dependency.JsModule;
22+
23+
@Tag("alpha-addon")
24+
@JsModule("./alpha.js")
25+
public class AlphaComponent extends Component {
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright 2000-2025 Vaadin Ltd.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
17+
package com.vaadin.addon.alpha;
18+
19+
import com.vaadin.flow.component.Component;
20+
import com.vaadin.flow.component.HasComponents;
21+
import com.vaadin.flow.component.Tag;
22+
import com.vaadin.flow.router.Route;
23+
24+
@Route("alpha-addon")
25+
@Tag("div")
26+
public class AlphaRoute extends Component implements HasComponents {
27+
28+
public AlphaRoute() {
29+
add(new AlphaComponent());
30+
}
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright 2000-2025 Vaadin Ltd.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
17+
package com.vaadin.addon.alpha;
18+
19+
import com.vaadin.flow.component.Component;
20+
import com.vaadin.flow.component.Tag;
21+
import com.vaadin.flow.component.dependency.JsModule;
22+
23+
@Tag("alpha-addon")
24+
@JsModule("./not-used.js")
25+
public class UnusedComponent extends Component {
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
window.alpha = 1;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log("never imported")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright 2000-2025 Vaadin Ltd.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
17+
package com.vaadin.addon.beta;
18+
19+
import com.vaadin.flow.component.Component;
20+
import com.vaadin.flow.component.Tag;
21+
import com.vaadin.flow.component.dependency.JsModule;
22+
23+
@Tag("beta-addon")
24+
@JsModule("./beta.js")
25+
public class BetaComponent extends Component {
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright 2000-2025 Vaadin Ltd.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
17+
package com.vaadin.addon.beta;
18+
19+
import com.vaadin.flow.component.Component;
20+
import com.vaadin.flow.component.HasComponents;
21+
import com.vaadin.flow.component.Tag;
22+
import com.vaadin.flow.router.Route;
23+
24+
@Route("beta-addon")
25+
@Tag("div")
26+
public class BetaRoute extends Component implements HasComponents {
27+
28+
public BetaRoute() {
29+
add(new BetaComponent());
30+
}
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
window.alpha = 1;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#
2+
# Copyright 2000-2025 Vaadin Ltd.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
# use this file except in compliance with the License. You may obtain a copy of
6+
# the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
# License for the specific language governing permissions and limitations under
14+
# the License.
15+
#
16+
17+
invoker.goals=clean verify -DskipTests
18+
invoker.profiles.1=
19+
invoker.profiles.2=disable-optimized-bundle
20+
invoker.profiles.3=exclude
21+
invoker.profiles.4=exclude,disable-optimized-bundle
22+
invoker.profiles.5=include
23+
invoker.profiles.6=include,disable-optimized-bundle
24+
invoker.profiles.7=exclude-all
25+
invoker.profiles.8=exclude-all,disable-optimized-bundle
26+
invoker.profiles.9=disabled-scan-config
27+
invoker.profiles.10=disabled-scan-config,disable-optimized-bundle
28+
invoker.profiles.11=exclude-target
29+
invoker.profiles.12=exclude-target,disable-optimized-bundle

0 commit comments

Comments
 (0)