美文网首页
maven项目打包,java命令运行

maven项目打包,java命令运行

作者: 少年眼蓝不及海 | 来源:发表于2023-10-17 11:02 被阅读0次
              <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>3.2.1</version>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>shade</goal>
                            </goals>
                            <configuration>
                                <transformers>
                                    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                        <mainClass>util.SM24.DataPushUtil</mainClass>
                                    </transformer>
                                </transformers>
                                <filters>
                                    <filter>
                                        <artifact>*:*</artifact>
                                        <excludes>
                                            <exclude>module-info.class</exclude>
                                            <exclude>META-INF/*.SF</exclude>
                                            <exclude>META-INF/*.DSA</exclude>
                                            <exclude>META-INF/*.RSA</exclude>
                                        </excludes>
                                    </filter>
                                </filters>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
    
    idea  maven package之后,target下出现两个jar包,xxxxxx.jar   包含依赖 ,original-xxx.jar  不包含依赖
    
    java -jar xxxxxx.jar
    

    相关文章

      网友评论

          本文标题:maven项目打包,java命令运行

          本文链接:https://www.haomeiwen.com/subject/mtofidtx.html