Skip to content

Allow the test classes directory to be configured for the NativeTestMojo #757

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

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

Conversation

thegridman
Copy link

The NativeTestMojo hard codes the location of the test classes to be the project.build.testOutputDirectory. Some Maven projects have test classes in other locations, for example under src/main/java which compiles them to the project.build.outputDirectory.

This PR allows the test classes location to be configured for the NativeTestMojo in the same way that plugins such as Surefire and Failsafe do by setting the <testClassesDirectory> element in the plugin configuration. The default is the project.build.testOutputDirectory.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jul 30, 2025
<skip>false</skip>
<imageName>${imageName}</imageName>
<fallback>false</fallback>
<testClassesDirectory>${project.build.outputDirectory}</testClassesDirectory>
Copy link
Member

@vjovanov vjovanov Aug 6, 2025

Choose a reason for hiding this comment

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

I am wondering if we can go without an extra parameter. How does the surefire plugin know the test-classes path?

Copy link
Author

Choose a reason for hiding this comment

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

Surefire and Failsafe both assume that the tests are in the default locations. But both have an optional <testClassesDirectory> configuration element that allows you to set a different location. In our case we have test modules where that only contain tests and the source is all under src/main/java and gets compiled to target/classes so we have to tell Surefire and Failsafe to use these directories.

@vjovanov vjovanov requested a review from melix August 6, 2025 09:50
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.

2 participants