简体   繁体   中英

No main manifest attribute in .jar

I search in Internet many information, but I don't know what's porblem is that... Please, check this: 在此处输入图片说明

在此处输入图片说明

Manifest:

Manifest-Version: 1.0
Main-Class: BotPolytechnic

POM:

<groupId>FPolytechnic</groupId>
<artifactId>FPolytechnic</artifactId>
<version>1.0</version>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
                <archive>
                    <manifest>
                        <mainClass>BotPolytechnic</mainClass>
                    </manifest>
                </archive>
            </configuration>
        </plugin>
    </plugins>
</build>

use instead the maven-jar-plugin to make the JAR executable:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>

    <configuration>
      <archive>
        <manifest>
          <addClasspath>true</addClasspath>
          <mainClass>fully.qualified.MainClass</mainClass>
        </manifest>
      </archive>
    </configuration>

  </plugin>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM