"no main manifest attribute" when building .jar (Gradle)

44 views Asked by At

I've been trying many different things throughout various posts, but none of the solutions have helped me.

  1. Creating an artifact through Build -> Build artifacts..., selecting directory for META-INF/MANIFEST.MF as main\resources and running a generated jar file throws no main manifest attribute.

  2. <..>, selecting directory for META-INF/MANIFEST.MF as main\java and running a generated jar file returns Could not find or load main class.

My MANIFEST.MF:

Manifest-Version: 1.0
Main-Class: <package>.MainApplication

Also, in my build.gradle I have:

jar {
    manifest {
        attributes 'Main-Class': '<package>.MainApplication'
    }
}

I have tried creating a new project, but the problem persisted the same. I hope someone could help me. Thank you.

UPDATE:

Demo project example (FileMail), which produces my error.

Demo project example (MediaFire)

UPDATE 2:

Demo project 2 example

0

There are 0 answers