Closed unkish closed 2 months ago
Looks like JsonSchemaPluginSpec::java is executed prior snapshot artifact is generated causing build failure. Reverting changes from build.gradle would help but there would be no "test" to validate the fix later on.
@joelittlejohn any thoughts on how to proceed ?
One way to validate my claim would be to rename JsonSchemaPluginSpec
to JsonSchemaPluginSpecIT
and add following section to jsonschema2pojo-gradle-plugin\pom.xml
:
<plugin>
<!-- switch off surefire, there's no unit tests in this module -->
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
Ah yes, thanks @unkish. I had noticed this a while back, when there was some problem in the plugin but it did not get shown until after an install
.
I think your solution to use failsafe instead of surefire and attach it to a later phase is a good one :+1:
Is this ready to merge now?
In last change that succeeded I've split test into unit (jsonschema2pojo-gradle-plugin/src/test/groovy/org/jsonschema2pojo/gradle/JsonSchemaPluginSpec.groovy) and integration test (jsonschema2pojo-gradle-plugin/src/integrationTest/groovy/org/jsonschema2pojo/gradle/GradleBuildIT.groovy) and configured jsonschema2pojo-gradle-plugin
to execute both: failsafe
and surefie
.
I can switch it to run only failsafe
and disable surefire
- would that be preferred way ?
@joelittlejohn adjusted jsonschema2pojo-gradle-plugin
such that it would only execute maven-failsafe-plugin
in install
phase and skip running maven-surefire-plugin
.
With these changes it should be ready (if there is nothing that I've missed)
Sorry @unkish I misunderstood. I didn't realise there were unit tests. I'm happy to use surefire and failsafe, each for the appropriate kind of test.
@joelittlejohn no worries.
I have one concern though: it seems that at present github actions will skip integration tests in jsonschema2pojo-gradle-plugin
as:
- name: Verify with Maven
run: mvn verify -B
will not trigger it since verify
is prior install
phase, and
- name: Install latest jsonschema2pojo SNAPSHOT
run: mvn -U -B install -DskipTests -Dmaven.javadoc.skip -Dmaven.site.skip
will not trigger it due -DskipTests
.
I would imagine that something like:
- name: Verify with Maven
run: mvn verify -B
- name: Verify jsonschema2pojo-gradle-plugin integration tests
run: mvn -U -B install -DskipTests -Dmaven.javadoc.skip -Dmaven.site.skip -pl jsonschema2pojo-gradle-plugin -am
run: mvn -U -B install -pl jsonschema2pojo-gradle-plugin
would "remedy" the issue, however I'm not sure whether it is an overall good solution or not
Closes #1010
Seems it got broken with #748, specifically this line.
Note: users would have to explicitly invoke
clean
whenever they have URL as source and know that content behind URL has changed