Skip to content

Commit 95cd659

Browse files
committed
feature: update Gradle build configuration to exclude tests while preserving quality checks
1 parent 0b49c72 commit 95cd659

1 file changed

Lines changed: 22 additions & 6 deletions

File tree

  • modules/openapi-generator-gradle-plugin

modules/openapi-generator-gradle-plugin/pom.xml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,20 @@
143143
<groupId>org.fortasoft</groupId>
144144
<artifactId>gradle-maven-plugin</artifactId>
145145
<executions>
146-
<!-- Override the gradle-build execution: swap `build` (assemble + test)
147-
for `assemble` (no tests) when -Dmaven.test.skip=true is set. -->
146+
<!-- Override the gradle-build execution: keep `build` (so checkstyle,
147+
spotbugs, and other check-lifecycle tasks still run) but add
148+
`-x test` to exclude only the Gradle test task, mirroring
149+
Maven's maven.test.skip behaviour which does not skip quality checks. -->
148150
<execution>
149151
<id>gradle-build</id>
150152
<configuration>
153+
<args combine.children="append">
154+
<arg>-x</arg>
155+
<arg>test</arg>
156+
</args>
151157
<tasks>
152158
<task>clean</task>
153-
<task>assemble</task>
159+
<task>build</task>
154160
<task>publishToMavenLocal</task>
155161
</tasks>
156162
</configuration>
@@ -165,6 +171,9 @@
165171
<activation>
166172
<property>
167173
<name>skipTests</name>
174+
<!-- Maven maps bare -DskipTests to the string "true", so this matches
175+
both -DskipTests and -DskipTests=true but NOT -DskipTests=false. -->
176+
<value>true</value>
168177
</property>
169178
</activation>
170179
<build>
@@ -173,14 +182,21 @@
173182
<groupId>org.fortasoft</groupId>
174183
<artifactId>gradle-maven-plugin</artifactId>
175184
<executions>
176-
<!-- Override the gradle-build execution: swap `build` (assemble + test)
177-
for `assemble` (no tests) when -DskipTests is set. -->
185+
<!-- Override the gradle-build execution: keep `build` (so checkstyle,
186+
spotbugs, and other check-lifecycle tasks still run) but add
187+
`-x test` to exclude only the Gradle test task.
188+
combine.children="append" appends to the plugin-level <args>
189+
instead of replacing them, preserving -P openApiGeneratorVersion. -->
178190
<execution>
179191
<id>gradle-build</id>
180192
<configuration>
193+
<args combine.children="append">
194+
<arg>-x</arg>
195+
<arg>test</arg>
196+
</args>
181197
<tasks>
182198
<task>clean</task>
183-
<task>assemble</task>
199+
<task>build</task>
184200
<task>publishToMavenLocal</task>
185201
</tasks>
186202
</configuration>

0 commit comments

Comments
 (0)