Skip to content
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

Allow URL(s) as source in jsonschema2pojo-gradle-plugin #1554

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

unkish
Copy link
Collaborator

@unkish unkish commented Aug 10, 2023

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

@unkish
Copy link
Collaborator Author

unkish commented Aug 10, 2023

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>

@joelittlejohn
Copy link
Owner

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 👍

Is this ready to merge now?

@unkish
Copy link
Collaborator Author

unkish commented Aug 11, 2023

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 ?

@unkish
Copy link
Collaborator Author

unkish commented Aug 11, 2023

@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)

@joelittlejohn
Copy link
Owner

joelittlejohn commented Aug 11, 2023

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.

@unkish
Copy link
Collaborator Author

unkish commented Aug 12, 2023

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

URL as source not working in latest releases
2 participants