[JAVA] What to do if you are told "there is no main manifest attribute" when creating a jar file containing dependencies in a maven project

As the title says ...

Package with dependencies

Use the maven-assembly-plugin plugin to package all the dependencies.

Add it under project-> build-> plugins in pom.xml.

pom.xml


<build>
    <plugins>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
            <archive>
              <manifest>
                <mainClass>com.example.App</mainClass>
              </manifest>
            </archive>
          <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
          </descriptorRefs>
        </configuration>
      </plugin>
    </plugins>
  </build>

Like this.

When I run the jar, it says "there is no main manifest attribute"

If you don't specify configuration-> ʻarchive- manifest-> mainClass` (at least in my trial), the title will say" No main manifest attribute "when running the jar. I did.

Recommended Posts

What to do if you are told "there is no main manifest attribute" when creating a jar file containing dependencies in a maven project
[Maven] What to do if you are asked to incorporate a jar that is not in the remote repository into the war
What to do when you want to delete a migration file that is "NO FILE"
What to do if the changes are not reflected in the jar manifest file
How to make a jar file with no dependencies in Maven
What to do if zip dies if there is a pom when making an executable jar with gradle
What to do if Operation not permitted is displayed when you execute a command in the terminal
What to do if you get Could not save master table to file after importing a project in Eclipse
What to do if Command line is too long appears when building a gradle project in Intellij IDEA
What to do if you get a java.io.IOException in GlassFish
What to do if you get a gcc error in Docker
What to do if the Eclipse Maven dependency Jar is wrong
What to do if you get a DISPLAY error in gym.render ()
What to do if you get a JNI shared library error when trying to build in Eclipse
What to do if you get a groovy warning in Thymeleaf Layout
What to do if tomcat process remains when tomcat is stopped in eclipse
What to do if you get an "A server is already running." Error when you try to start the rails server
What to do if you get a SQLite3 :: BusyException: database is locked error
What to do if you get a wrong number of arguments error in binding.pry
What to do when rbenv says that there is no readline or lib history
What to do if you get a NoClassDefFoundError when trying to run eclipse on Java9
What to do if you get a port error when docker-compose up on Mac
What to do if you accidentally create a model
What to do when rails creates a 〇〇 2.rb file
How to make a jar with old Hadoop (hadoop-core-0.20.2-cdh3u6) in Gradle: (What to do if you get Could not expand ZIP ..)
[Rails Tutorial Chapter 2] What to do when you make a mistake in the column name
What to do if you get a "Cannot Pull Container Error" when starting ECS ​​Fargate
What to do if you get a "302" error in your controller unit test code in Rails
[Swift5] What to do if you want to commit files to github but there are too many
What you need to do to open a file from the menu in the document-Based App macOS app
I added a Jar file to the build path in an Eclipse project, but the situation and what to do when `java.util.zip.ZipException: invalid LOC header (bad signature)` appears.
When there is no output to stdout in docker log
What to do if you get a "Mysql2 :: Error: Operand should contain 1 column (s)" error in Rails
What to do when you want to know the source position where the method is defined in binding.pry
If you get a "Quantum Renderer: no suitable pipeline found" error when running the jar file
[Java] What to do if a lot of "File is opened too much" is displayed due to FileNotFoundException
What to do if an error occurs when doing npm install axios in React + Typescript project
What is a jar file?
What to do when an UnsupportedCharsetException occurs in a lightweight JRE
[Rails] What to do if data is not registered in DB
What to do when the changes in the Servlet are not reflected
About what I did when creating a .clj file in Clojure
What to do if Cloud9 is full in the Rails tutorial
What to do when you become a Problem During Content Assist
What to do when you run into a docker-compose node_modules problem
What to do if you forget the root password in CentOS7
What to do if you get Application with name appName is already registered. When you try to start GlassFish
What to do if the prefix c is not bound in JSP
What to do if you get an error when you hit Heroku logs
What to do if you get a MiniMagick vulnerability alert on GitHub
Notes on what to do when a WebView ClassNotFoundException occurs in JavaFX 12
What to do if you get a javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake in the IBM JDK