mevan pom.xml常见问题

打包依赖,同时添加主类,使用 assembly:assembly打包

   <plugins>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>recommend.merge</mainClass>
                    </manifest>
                </archive>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
        </plugin>

使用package打包,同时加入依赖,指定主类

<build>
<plugins>
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.1.0</version>
                <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>cal.hive</mainClass>
                        </transformer>
                    </transformers>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
</plugins>
</build>

报错

Missing artifact jdk.tools:jdk.tools:jar:1.7

<dependency>  
    <groupId>jdk.tools</groupId>  
    <artifactId>jdk.tools</artifactId>  
    <version>1.7</version>  
    <scope>system</scope>  
    <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>  
</dependency> 

报错

java.lang.SecurityException: Invalid signature file digest for Manifest main attributes

由于某些包的重复引用,以至于打包之后的META-INF的目录下多出了一些.SF,.DSA,*.RSA文件所致
这里写图片描述

主类可以在MANIFEST.MF文件中手动添加
MANIFEST.MF文件内容
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Built-By: Administrator
Created-By: Apache Maven 3.3.9
Build-Jdk: 1.8.0_131
Main-Class: cal.hive

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值