Problems with .jar

2

Good morning, I have a Maven project running on Netbeans, however, the .jar generated says at runtime: "no main manifest attribute in example.jar" . p>

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

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

    
asked by anonymous 17.03.2015 / 14:43

1 answer

1

It was not possible to determine which class has 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 section has to be added to the pom.xml file, inside the project tag.

    
16.08.2016 / 18:36