使用gradle构建多模块springboot项目,打jar包
官方文档: https://spring.io/guides/gs/rest-service/ 参考:http://blog.csdn.net/u013360850/article/details/53415005
1:spring boot 的需要脚本添加插件,首先创建多模块gradle项目,根目录的src classpath删除了。

2:在根工程build.gradle文件中添加配置。
group 'com.li'
version '1.0-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'application' sourceCompatibility = 1.8 subprojects {
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
version = '1.0' // JVM 版本号要求
sourceCompatibility = 1.8
targetCompatibility = 1.8 // java编译的时候缺省状态下会因为中文字符而失败
[compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'
ext {
springBootVersion = '1.5.9.RELEASE'
}
repositories {
//maven { url "http://maven.springframework.org/release" } //添加maven源
//maven { url "https://maven.fabric.io/public" } }
mavenCentral()
}
jar {
manifest {
attributes("Implementation-Title": "Gradle")
}
}
dependencies {
// compile('org.springframework.boot:spring-boot-starter-web')
testCompile group: 'junit', name: 'junit', version: '4.12'
}
}
3:要在子模块中添加 springboot依赖,要不然解析不了classpath组件。
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.0.RELEASE")
}
}
group 'com.li'
version '1.0-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
testCompile('org.springframework.boot:spring-boot-starter-test')
}
4:加入依赖成功,可以按照上面的链接进行创建工程。
5:打jar 包,直接在build下面运行 bootRepackage , 在 build/lib下面找到jar包,直接运行 java -jar ...jar
http://blog.csdn.net/ddjjll8877/article/details/60139640
使用gradle构建多模块springboot项目,打jar包的更多相关文章
- 使用Gradle构建多模块SpringBoot项目
使用Gradle构建多模块SpringBoot项目 本项目使用Gradle构建SpringBoot项目,将不同的业务进行不同的模块划分(不做微服务与分布式架构); - 编辑器:Intellij IDE ...
- SpringBoot项目打成jar包后上传文件到服务器 目录与jar包同级问题
看标题好像很简单的样子,但是针对使用jar包发布SpringBoot项目就不一样了.当你使用tomcat发布项目的时候,上传文件存放会变得非常简单,因为你可以随意操作项目路径下的资源.但是当你使用Sp ...
- 【转载】JAVA SpringBoot 项目打成jar包供第三方引用自动配置(Spring发现)解决方案
JAVA SpringBoot 项目打成jar包供第三方引用自动配置(Spring发现)解决方案 本文为转载,原文地址为:https://www.cnblogs.com/adversary/p/103 ...
- SpringBoot项目打成Jar包时运行
使用java -jar ***.jar执行jar包的时候,会找jar包中的main()方法. 对于SpringBoot项目的Jar包,在META-INF目录下的MANIFEST.MF文件中,Main- ...
- springboot项目实现jar包外配置文件管理
背景 为实现快速搭建和开发,项目以Springboot框架搭建,springboot搭建的项目可以将项目直接打成jar包并运行,无需自己安装配置Tomcat或者其他服务器,是一种方便快捷的部署方式. ...
- JAVA SpringBoot 项目打成jar包供第三方引用自动配置(Spring发现)解决方案
本项目测试环境 JDK: 1.8 SpringBoot: 2.1 需求描述 当我们想要利用SpringBoot封装一套组件并发布给第三方使用时,我们就不得不考虑我们的组件能否被使用者正确引入使用,此处 ...
- 在IDEA中使用Maven将SpringBoot项目打成jar包、同时运行打成的jar包(前后端项目分离)
1.maven教程官网 https://m.runoob.com/maven/ 2.理解Maven的构建生命周期(clean.Package) 3.在项目中使用maven进行打包 4.运行打包好的ja ...
- eclipse中,将springboot项目打成jar包
1.右击项目,选择Run As - Maven clean 2.右击项目,选择Run As - Maven install 3.成功后 会在项目的target文件夹下生成jar包 4.将打包好的jar ...
- springboot项目打成jar包后台运行在linux上
背景:springboot2为为主体搭建的项目,直接打成jar包,上传到linux上面 启动项目:java -jar xx.jar 这样很方便,但是不能关闭窗口,否则项目就停了 后台启动: nohup ...
随机推荐
- Andoid数据存储之SQLite数据库
SQLite是一个嵌入式的并且是一个轻量级的数据库: SQLite数据库支持大部分SQL语法, 允许使用SQL语句操作数据库, 其本质是一个文件, 不需要安装启动: SQLite数据库打开只是打开了一 ...
- 【Linux】 基于centos7.2 安装 LAMP
服务器选择的阿里云ecs服务器,系统centos7.2版 一.连接服务器,检查当前系统环境 1.查看centos版本 [root@iZuf682jnxmszwd2gdvzh0Z ~]# cat /et ...
- 概率法计算PI
#include <iostream> using namespace std; //概率计算PI int main() { ; double val; int i; ; i<; i ...
- Android与互联网的交互方式有三种
数据下载:下载网络上的的数据,包括图片.代码文本.XML文件.JSON数据,音/视频等大文件,调用webservice. 数据上传:上传图片.文本.XML.JSON数据.音/视频文件,调用webser ...
- ndk编译android的lame库
1.lame c库: https://github.com/intervigilium/liblame 下载后解压,进入目录,terminal里运行ndk-build即可 2.lame android ...
- Oracle 12C 创建用户连接pdb
测试环境: C:\ora12c\product\12.1.0\dbhome_1\BIN>sqlplus.exe /nolog SQL*Plus: Release 12.1.0.1.0 Produ ...
- Gym 101915G Robots
G. Robots time limit per test 5.0 s memory limit per test 256 MB input standard input output standar ...
- 2015.7.7js-07-2(基础)
1.用求模来计算时间,秒%60,就能获取剩余的秒 var s = 362; var minute = parseInt(s/60) + "分" //取得分 var second = ...
- jquery.fn.extend与jquery.extend用法与区别
jQuery为开发插件提拱了两个方法,分别是: 代码如下 复制代码 jQuery.fn.extend(object); 和 jQuery.extend(object); jQuery.exte ...
- 常见的几个js疑难点,match,charAt,charCodeAt,map,search
JavaScript match() 方法 定义和用法 match() 方法可在字符串内检索指定的值,或找到一个或多个正则表达式的匹配. 该方法类似 indexOf() 和 lastI ...