No main manifest attribute - IntelliJ

I know that there have been many reports, but I cannot find a suitable solution. So, I have 3 classes, one with the main one, and from IntelliJ everything works fine. But I can not run the .jar file that I created.

I also have a manifest file that contains the following:

Manifest-Version: 1.0 Main-Class: beanParser 

I created the jar through the build option in IntelliJ. Any suggestions?

thanks

+5
source share
2 answers

Did you read the following link?

For Maven, see the next clip or this .

Here I disabled in my project:

 <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.4</version> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> <mainClass>your.main.Clazz</mainClass> <classpathPrefix>lib/</classpathPrefix> </manifest> </archive> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.8</version> <executions> <execution> <id>copy-dependencies</id> <phase>package</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputDirectory> ${project.build.directory}/lib/ </outputDirectory> </configuration> </execution> </executions> </plugin> </plugins> </build> 
+5
source

MANIFEST.MF must be located in:

src/main/resources/META_INF/

NOT in:

src/main/java/META_INF/

+6
source

Source: https://habr.com/ru/post/1211241/


All Articles