0

I am trying to generate JAR file of simple program with log4j in Maven. Here is my XML:

    <dependencies>
   <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
      <type>jar</type>
   </dependency>
</dependencies>


<build>   
   <plugins>
    <plugin>
      <artifactId>maven-assembly-plugin</artifactId>
      <configuration>
        <archive>
          <manifest>
            <mainClass>path.gui.MainGui</mainClass>
          </manifest>
        </archive>
        <descriptorRefs>
          <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
      </configuration>
    </plugin>   
  </plugins> 
 </build>

I can ensure you that path to my main class IS correct (checked multiple times). Yet, what I am getting after java -jar MyApp.jar is:

   no main manifest attribute, in MyApp.jar

What's wrong? Why am I not getting main attribute?

  • Here is a link to an existing question with a lot of good information: https://stackoverflow.com/questions/9689793/cant-execute-jar-file-no-main-manifest-attribute Give some of them go and see if you have any luck, notibaly make sure META-INF is in the resources folder, and add `true` inside your manifest XML tag – sorifiend Apr 07 '21 at 22:01

1 Answers1

0

You are using the assembly plugin where you should use the jar-archiver.

Queeg
  • 7,748
  • 1
  • 16
  • 42