赞
踩
Java程序,使用Maven打包,将所有依赖的jar都打包到一个可执行的jar中,
在pom.xml中增加以下配置即可:
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <archive>
- <manifest>
- <!--这里要替换成jar包main方法所在类 -->
- <mainClass>com.sam.project.send.RcsAccessTokenUtils</mainClass>
- </manifest>
- <manifestEntries>
- <Class-Path>.</Class-Path>
- </manifestEntries>
- </archive>
- <descriptorRefs>
- <descriptorRef>jar-with-dependencies</descriptorRef>
- </descriptorRefs>
- </configuration>
- <executions>
- <execution>
- <id>make-assembly</id> <!-- this is used for inheritance merges -->
- <phase>package</phase> <!-- 指定在打包节点执行jar包合并操作 -->
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。