Luponius
Luponius

Reputation: 87

GMavenPlus: Groovy to JAR - Failed to find or load main class. Main class is present, manifest file appears valid

I've done a successfull mvn clean install on the project I built and the structure appears correct, all classes included and manifest is under META-INF including class-paths and main-class. Not sure what's not matching up here, but the class contents are valid when I checked contents using javap. Main method is present in the redacted_automatedSupport class and is also public.

Error:

host MINGW64 ~/Desktop/Projects/redacted_Automated_Support/target (master)
$ java -jar redacted_automatedSupport-1.0.jar
Error: Could not find or load main class support.redacted_automatedSupport

host MINGW64 ~/Desktop/Projects/redacted_Automated_Support/target (master)
$ java -cp redacted_automatedSupport-1.0.jar support.redacted_automatedSupport
Error: Could not find or load main class support.redacted_automatedSupport

host MINGW64 ~/Desktop/Projects/redacted_Automated_Support/target (master)
$

Manifest contents:

Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Built-By: bennet.vella
Class-Path: aws-java-sdk-s3-1.11.696.jar aws-java-sdk-kms-1.11.696.jar
  aws-java-sdk-core-1.11.696.jar commons-logging-1.1.3.jar httpclient-
 4.5.9.jar httpcore-4.4.11.jar commons-codec-1.11.jar ion-java-1.0.2.j
 ar jackson-databind-2.6.7.3.jar jackson-annotations-2.6.0.jar jackson
 -core-2.6.7.jar jackson-dataformat-cbor-2.6.7.jar joda-time-2.8.1.jar
  jmespath-java-1.11.696.jar groovy-3.0.1.jar groovy-json-3.0.1.jar gr
 oovy-dateutil-3.0.1.jar
Created-By: Apache Maven 3.6.3
Build-Jdk: 1.8.0_231
Main-Class: support.redacted_automatedSupport

Jar Archive Contents (renamed to zip to browse):

Jar archive contents

Support Jar Contents (removed some unecessary data, all names match): Support Jar Contents

Upvotes: 0

Views: 197

Answers (1)

Luponius
Luponius

Reputation: 87

It is not a complete answer, since it doesn't target the Maven issue I was having, but I did solve the IntelliJ problem I had with the wrong manifest file - and that's because I was creating the manifest in src/main/java when it should have been src/main/resources. This should hopefully alleviate some users' problems.

I have not however resolved how to properly build and include all relevant dependent jars using Maven - intelliJ does this successfully.

Upvotes: 0

Related Questions