1、前言

用过spring boot的同学肯定知道,现在web项目可以直接打成jar包运行,相当方便。

那么普通项目如何配置(非spring boot),才能打成一个类似的jar包呢?

2、解决方案:

在pom中的build中进行如下配置即可:

        <plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<!--这里指定要运行的main类-->
<mainClass>netty.client.TcpClient809</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- 此处指定继承合并 -->
<phase>package</phase> <!-- 绑定到打包阶段 -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>

3、普通java工程,如何获取所有依赖的jar包

If you need to download the jars instead of using a build system, create a Maven pom file like this with the desired version:

<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.netflix.hystrix.download</groupId>
<artifactId>hystrix-download</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Simple POM to download hystrix-core and dependencies</name>
<url>http://github.com/Netflix/Hystrix</url>
<dependencies>
<dependency>
<groupId>com.netflix.hystrix</groupId>
<artifactId>hystrix-core</artifactId>
<version>x.y.z</version>
<scope/>
</dependency>
</dependencies>
</project>

Then execute:

mvn -f download-hystrix-pom.xml dependency:copy-dependencies

It will download hystrix-core-*.jar and its dependencies into ./target/dependency/.

You need Java 6 or later.

最新文章

  1. weblogic
  2. JQuery学习
  3. 10分钟使用纯css实现完整的响应式导航菜单栏的效果
  4. Halcon标定步骤
  5. vector中pair的排序方法
  6. Boostrap(3)
  7. loj 1011(状态压缩+记忆化搜索)
  8. linux如何修改主机名
  9. Web应用开发工具及语言需要具备的功能探索
  10. Windows7配置GPU和Theano编程环境
  11. UI:这段时间的小总结
  12. Asp.Net生命周期系列二
  13. iOS7适配之设计篇
  14. css考核点整理(十一)-响应式开发经验,响应式页面的三种核心技术是什么
  15. CGContext
  16. 1104--DNA排序
  17. asp.net中利用Jquery+Ajax+Json实现无刷新分页(二)
  18. 你必须知道的.net读书笔记第四回:后来居上:class和struct
  19. 20190219备份 java spring boot 学习链接(日/英)
  20. MVC model验证 获取验证错误信息

热门文章

  1. 基于 HTML5 WebGL 构建智能数字化城市 3D 全景
  2. zabbix 监控apache
  3. tomcat启动内存溢出三种解决方案:java.lang.OutOfMemoryError:PermGen space解决办法
  4. ASP.NET Core知多少(13):路由重写及重定向
  5. Python文件的操作函数的使用
  6. js 对象 / json / jsonb / jsonp 区别
  7. Js实现回车登录,监听回车事件
  8. 转pytorch中训练深度神经网络模型的关键知识点
  9. 【5000 Stars 福利】微信接口动态 WebApi 使用说明
  10. Android数据库GreenDao的使用总结