Skip to content

Conversation

hgschmie
Copy link

  • skipTestExecution (boolean), default is false

If true, create the native image for the tests but do not execute it. This allows the creation of the native images for testing even if they don't fully execute / tests fail. Otherwise, the build would stop at the first test failure.

  • failNoTests (boolean), default is true

If true, fail building if no tests were found. In multi-module builds, there are often modules that have no tests (documentation) or tests are enabled/disabled by profiles (slow tests, e2e tests etc.). This switch allows for a concise configuraiton of the native plugin and then skipping modules where no tests were run without failing the build.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Apr 24, 2025
hgschmie added a commit to hgschmie/jdbi that referenced this pull request Apr 24, 2025
QnD attempt to add native compilation to the tree, run with `-Dnative`.

Note: Does not work with the out of the box plugin but requires
graalvm/native-build-tools#720 applied to the
graalvm native plugin and that the embedded junit version (in
https://github.com/graalvm/native-build-tools/blob/master/gradle/libs.versions.toml)
matches the version in jdbi (currently 5.13.0-M2).

native images build but don't work. This is only a "proof of concept, compiles" sketch.
hgschmie added a commit to hgschmie/jdbi that referenced this pull request May 1, 2025
QnD attempt to add native compilation to the tree, run with `-Dnative`.

Note: Does not work with the out of the box plugin but requires
graalvm/native-build-tools#720 applied to the
graalvm native plugin and that the embedded junit version (in
https://github.com/graalvm/native-build-tools/blob/master/gradle/libs.versions.toml)
matches the version in jdbi (currently 5.13.0-M2).

native images build but don't work. This is only a "proof of concept, compiles" sketch.
@hgschmie
Copy link
Author

hgschmie commented May 4, 2025

pretty ping?

@dnestoro dnestoro requested a review from alvarosanchez June 10, 2025 10:30
Copy link
Member

@alvarosanchez alvarosanchez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be documented

@hgschmie
Copy link
Author

Added documentation, rebased to the current main branch.

alvarosanchez
alvarosanchez previously approved these changes Sep 24, 2025
@dnestoro
Copy link
Collaborator

dnestoro commented Sep 24, 2025

@hgschmie thanks for your patience. Can you please also provide test that shows how these flags work?

You can add a new profile on the existing samples, where you will enable your flags, and add new test in the corresponding functional test. Check functional tests here: https://github.com/graalvm/native-build-tools/tree/master/native-maven-plugin/src/functionalTest/groovy/org/graalvm/buildtools/maven

Also, please add a changelog entry for this.

@hgschmie
Copy link
Author

Ok, will do tonight.

- skipTestExecution (boolean), default is false

If true, create the native image for the tests but do not execute it. This allows the creation of the native images for testing even if they don't fully execute / tests fail. Otherwise, the build would stop at the first test failure.

- failNoTests (boolean), default is true

If true, fail building if no tests were found. In multi-module builds, there are often modules that have no tests (documentation) or tests are enabled/disabled by profiles (slow tests, e2e tests etc.). This switch allows for a concise configuraiton of the native plugin and then skipping modules where no tests were run without failing the build.
@hgschmie
Copy link
Author

Added functional tests and a changelog entry

@hgschmie
Copy link
Author

@dnestoro ready to be reviewed.


Learn more about Native Image build configuration https://www.graalvm.org/reference-manual/native-image/overview/BuildConfiguration/[on the website].

==== Build, but not execute native tests
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is too much for end-to-end guide. In end-to-end guide you should just mention that these properties exist, and explain them in one or two sentences. The full explanation should be in maven-plugin.adoc.

@olyagpl @ban-mi can you please provide your review for the documentation part here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation review done! Thank you!

I have created a ticket to look at this file as a whole later down the line to go through streamlining this guide

Copy link
Author

@hgschmie hgschmie Sep 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be useful to provide such guidance before asking for documentation. I am ok changing it, but I would like to know what the desired outcome is, otherwise it feels a bit like I am aiming at a moving target. I tried to follow the style in the maven-plugin.adoc file where there is a short, reference style explanation for each switch.

I shrank the text in the end-to-end guide down to a short paragraph and moved the bulk to the maven.adoc file in a new section "Controlling test execution".

@@ -0,0 +1,167 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you use existing sample java-application which already doesn't have tests? See: https://github.com/graalvm/native-build-tools/tree/master/samples/java-application.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that but the flag needs a build that has code in src/test but no tests. As java-application has no code in src/test at all, it does not run the native goals (it reports [main] INFO org.apache.maven.plugin.surefire.SurefirePlugin - No tests to run. That's why I added the new sample (which has code in src/test but not a test class).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But is that real scenario then? Why would someone have classes in src/test that doesn't have tests? I am okay with the change, but I am just wondering if it has real usecase?

Copy link
Collaborator

@dnestoro dnestoro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address comments I left


Learn more about Native Image build configuration https://www.graalvm.org/reference-manual/native-image/overview/BuildConfiguration/[on the website].

==== Build, but not execute native tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation review done! Thank you!

I have created a ticket to look at this file as a whole later down the line to go through streamlining this guide

@hgschmie
Copy link
Author

addressed the doc comments, moved docs around to reduce the size of the end-to-end guide text.
updated the functional test; can not use java-application because it has not code at all in the src/test folder; I did not want to add some dummy class here because it may interfere with other functional tests. LMK how to proceed here.

@dnestoro

@hgschmie
Copy link
Author

hgschmie commented Oct 2, 2025

anything more needed from me? I feel that I addressed all issues and this is good to be merged. This has been open for a very long time.

@hgschmie
Copy link
Author

hgschmie commented Oct 8, 2025

Bit at a loss here. I think I addressed all the issues but you seem to have gone silent on me. @dnestoro @alvarosanchez @ban-mi ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants