zoukankan      html  css  js  c++  java
  • maven打jar包 没有主属性清单

    使用mvn clean package命令打包,java -jar 命令运行时,提示:“jar 包没有主属性清单”。修改pom文件后解决:

    <build>
         <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-shade-plugin</artifactId>
                 <version>1.4</version>
                 <executions>
                     <execution>
                         <phase>package</phase>
                         <goals>
                             <goal>shade</goal>
                         </goals>
                         <configuration>
                             <filters>
                                 <filter>
                                     <artifact>*:*</artifact>
                                     <excludes>
                                         <exclude>META-INF/*.SF</exclude>
                                         <exclude>META-INF/*.DSA</exclude>
                                         <exclude>META-INF/*.RSA</exclude>
                                     </excludes>
                                 </filter>
                             </filters>
                             <transformers>
                                 <transformer
                                         implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                     <mainClass>com.cathy.demo.myMain</mainClass>
                                 </transformer>
                                 <transformer
                                         implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                     <resource>META-INF/spring.handlers</resource>
                                 </transformer>
                                 <transformer
                                         implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                     <resource>META-INF/spring.schemas</resource>
                                 </transformer>
                             </transformers>
                         </configuration>
                     </execution>
                 </executions>
             </plugin>
         </plugins>
    </build>


    其中:com.cathy.demo.myMain 为项目启动的main入口方法。

    参考:http://blog.csdn.net/defonds/article/details/43233131

  • 相关阅读:
    HttpSession
    查看端口被哪个进程占用了
    变体类型 Variant VARIANT
    BDE View not exists
    c++builder 解压缩
    nginx的allow和deny配置
    linux下如何启动nginx?
    java如何发起一次http的post请求?
    mysql如何用sql添加字段如何设置字符集和排序规则
    设置Tomcat的UTF-8编码
  • 原文地址:https://www.cnblogs.com/janes/p/8522099.html
Copyright © 2011-2022 走看看