Application plugin run task ingores gradle generated manifest

when using the run task of the application plugin I get an no such file error when trying to access the manifest file from inside of the application.
the manifest configuration and generation is bound to the java jar task which is not in the dependency path of the application run task.
it seems that the run task doesn’t put the fully generated application jar rather than the build/classes and build/resources dirs into the classpath.
does gradle allow somehow to create the manifest in a simple manner directly to build/resources dir?

I found a solution so far.
Its important to place the manifest into the build/classes/main directory rather than in the resources dir. In order to open the manifest from code the getProtectionDomain method is used. But classes and resources are different protection domains :frowning:

task writeManifest{ doFirst{ jar.manifest.writeTo("$buildDir/classes/main/META-INF/MANIFEST.MF") } }{ dependsOn writeManifest }

You can change the classpath of the run task easily to include the jar of your app and remove class folders. This would look like this:

run {
     classpath = jar.output.files + sourceSets.main.runtimeClasspath - sourceSets.main.output