Problems with the . jar

Asked

Viewed 2,316 times

2

Good morning guys, good I have a Maven project running over Netbeans however, the .jar generated says at time of execution: "no major manifest attribute in example.jar".

I heard there might be some problem in the file MANIFEST.MF, but I did not succeed in modifying it, I also heard about a plugin called maven-shade-plugin, that could help generate the . jar with the dependencies, but I did not understand how to use it, so I would like a help from you to be able to generate the blessed executable.

I would like to thank the whole community beforehand for the excellent work done in this forum.

1 answer

1

Failed to specify which class has the main.

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
              <archive>
                <manifest>
                    <mainClass>com.mycompany.stackoverflow.teste.App</mainClass>
                </manifest>
              </archive>
            </configuration>
        </plugin>
    </plugins>
</build>

The main class is placed in the mainClass tag. This snippet has to be added to the pom.xml file within the project tag.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.