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

When run -Pagent the reflection-config.json include Test classes #56

Closed
jarpz opened this issue Jun 17, 2021 · 4 comments
Closed

When run -Pagent the reflection-config.json include Test classes #56

jarpz opened this issue Jun 17, 2021 · 4 comments

Comments

@jarpz
Copy link

jarpz commented Jun 17, 2021

When run:

gradle -Pagent test

The reflection-config.json includes test classes, Is there any way to "filter" those classes in the generated file?.

I saw an "agent-filter.json" but there is not documentation about it.

Regards

@ScottPierce
Copy link

Does it matter if it includes reflection information for classes that are not actually compiled into the application?

@jarpz
Copy link
Author

jarpz commented Jun 17, 2021

Does it matter if it includes reflection information for classes that are not actually compiled into the application?

Yeah, native image generation fails because in the classpath those classes are not present. So you have to add the

-H:+AllowIncompleteClasspath

@lazar-mitrovic
Copy link
Collaborator

lazar-mitrovic commented Jun 18, 2021

You can use
gradle -Pagent run
if you want to generate agent output for main source set.

Filtering of classes which are detected during an agent run is done using agent-filter files. Advanced configuration of native-image-agent isn't (at the moment) exposed to the end-user through our plugins (you could work around that by changing JVM parameters when invoking relevant tasks of said build tools).

agent-filter.json which is present in the Gradle plugin is only used for filtering out internal Gradle classes (which are detected if run task is invoked in the same JVM as the Gradle process itself).

Also note that if you set agent=true in your configuration, --allow-incomplete-classpath will automatically be added to the native-image invocation.

@lazar-mitrovic
Copy link
Collaborator

I opened a new issue about fixing this error message: #65

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

No branches or pull requests

3 participants