Open stef-pellegrino opened 6 months ago
Synergy has a few features that are currently using reflection. This means those particular features will not work with native image without some extra meta-data.
You can either run the example once with the native image tracing agent enabled, or you can hand-craft a META-INF/native-image/synergy/reflect-config.json
resource and bundle it inside your jar before native compilation.
I just gave the example a quick try, and can confirm this is needed in this case. Add the following to reflect-config.json
.
[
{
"name":"com.sshtools.common.events.EventCodes",
"allPublicFields":true
},
{
"name":"com.sshtools.common.forwarding.ForwardingPolicy",
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"name":"com.sshtools.common.permissions.IPPolicy",
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"name":"com.sshtools.common.policy.AuthenticationPolicy",
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"name":"com.sshtools.common.policy.FileSystemPolicy",
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"name":"com.sshtools.common.publickey.bc.OpenSSHPrivateKeyFileBC"
},
{
"name":"com.sshtools.common.shell.ShellPolicy",
"methods":[{"name":"<init>","parameterTypes":[] }]
}
]
The "Port forwarding" sample does not work with this configuration:
Works perfectly with fat .jar (JVM), but crashes badly when compiling against "native-image"