gradles理解和文件配置
gradle
gradle tasks :查看所有的taske命令
bootJar:打包,讲项目的所有依赖和主工程代码打包,一个可直接执行的一个包,不需要tomcat运行
gradle使用bootjar打包后后,解压出来的三个目录
BOOT-INF:
classes:存放java文件编译后的class文件
lib:所有的lib依赖包
META-INF:
MANIFEST.MF:清单文件,描述当前项目可执行的一些信息
org/
springframework/
boot/
loader/: 打包jar包,没有显现的加入在第三方jiar包中,默认通过网络拉取下载,loader文件中JarLauncher.class文件中设置了jar包运行时的入口和打包 后文件的结构(定义了BOOT-INF,META-INF中放什么数据)
public class JarLauncher extends ExecutableArchiveLauncher {
private static final String DEFAULT_CLASSPATH_INDEX_LOCATION = "BOOT-INF/classpath.idx";
static final EntryFilter NESTED_ARCHIVE_ENTRY_FILTER = (entry) -> {
return entry.isDirectory() ? entry.getName().equals("BOOT-INF/classes/") : entry.getName().startsWith("BOOT-INF/lib/");
};
public JarLauncher() {
}
protected JarLauncher(Archive archive) {
super(archive);
}
protected ClassPathIndexFile getClassPathIndex(Archive archive) throws IOException {
if (archive instanceof ExplodedArchive) {
String location = this.getClassPathIndexFileLocation(archive);
return ClassPathIndexFile.loadIfPossible(archive.getUrl(), location);
} else {
return super.getClassPathIndex(archive);
}
}
private String getClassPathIndexFileLocation(Archive archive) throws IOException {
Manifest manifest = archive.getManifest();
Attributes attributes = manifest != null ? manifest.getMainAttributes() : null;
String location = attributes != null ? attributes.getValue("Spring-Boot-Classpath-Index") : null;
return location != null ? location : "BOOT-INF/classpath.idx";
}
protected boolean isPostProcessingClassPathArchives() {
return false;
}
protected boolean isSearchCandidate(Entry entry) {
return entry.getName().startsWith("BOOT-INF/");
}
protected boolean isNestedArchive(Entry entry) {
return NESTED_ARCHIVE_ENTRY_FILTER.matches(entry);
}
public static void main(String[] args) throws Exception {
(new JarLauncher()).launch(args);
}
}
配置文件说明
//相当于plugins{}
//开发语言
apply plugin :"java"
// 打包方式
apply plugin :"war"
//下载idea相关插件
apply plugin: "idea"
//maven的相关插件
apply plugin: "maven"
apply plugin: 'org.akhikhl.gretty'
//apply from: 'https://raw.github.com/akhikhl/gretty/master/pluginScripts/gretty.plugin'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.akhikhl.gretty:gretty:2.0.0'
}
}
repositories {
mavenCentral()
}
if (!project.plugins.findPlugin(org.akhikhl.gretty.GrettyPlugin))
project.apply(plugin: org.akhikhl.gretty.GrettyPlugin)
//配置服务器相关属性 tomcat
/*buildscript {
repositories {
mavenCentral()
}
dependencies{
classpath 'org.zkhikhl.gretty:gretty:2.0.0'
}
}
repositories {
mavenCentral()
}
if (!project.plugins.findPlugin(org.akhikhl.gretty.GretyPlugin))
project.apply (plugin: org.akhikhl.gretty.GretyPlugin)
//配置tomcat的属性*/
gretty {
// 端口号
httpPort = 8080
// 项目名
contextPath = '/mygradle'
host = 'localhost'
httpEnabled = true
// servlet的容器
servletContainer = 'tomcat8'
// 热部署
scanInterval = 1
// 检测是否发生修改,修改立刻生效
fastReload = true
// 日志级别
loggingLevel = 'DEBUG'
// 日治在哪里显示,在控制台显示
consoleLogEnabled = true
// ... many more properties
//调试配置 监听端口 需要在Run-->Edit-->添加remote-->修改监听端口 默认5005
//
debugPort = 8888
debugSuspend = true
}
/*
plugins {
//开发语言
id 'java'
// 打包方式
id 'war'
}*/
group 'com.zhang'
version '1.0-SNAPSHOT'
//指定java的jdk
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
// 依赖下载仓库:这里是maven仓库
mavenCentral()
}
//指定依赖包下载私服
/*dependencies{
repositories {
maven{
url:制定的ip地址
}
}
}*/
//jar包
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
}
//设置项目的各个阶段的编码
tasks.withType(JavaCompile){
options.encoding = "UTF-8"
}
[compileJava,javadoc,compileTestJava]*.options*.encoding ="UTF-8"
gradles理解和文件配置的更多相关文章
- 深入浅出Mybatis系列(八)---mapper映射文件配置之select、resultMap
上篇<深入浅出Mybatis系列(七)---mapper映射文件配置之insert.update.delete>介绍了insert.update.delete的用法,本篇将介绍select ...
- Spring、Spring MVC、MyBatis整合文件配置详解
原文 http://www.cnblogs.com/wxisme/p/4924561.html 主题 MVC模式MyBatisSpring MVC 使用SSM框架做了几个小项目了,感觉还不错是时候总 ...
- Spring简单的文件配置
Spring简单的文件配置 “计应134(实验班) 凌豪” 一.Spring文件配置 spring至关重要的一环就是装配,即配置文件的编写,接下来我按刚才实际过程中一步步简单讲解. 首先,要在web. ...
- 深入浅出Mybatis系列(八)---mapper映射文件配置之select、resultMap good
上篇<深入浅出Mybatis系列(七)---mapper映射文件配置之insert.update.delete>介绍了insert.update.delete的用法,本篇将介绍select ...
- 转载 Spring、Spring MVC、MyBatis整合文件配置详解
Spring.Spring MVC.MyBatis整合文件配置详解 使用SSM框架做了几个小项目了,感觉还不错是时候总结一下了.先总结一下SSM整合的文件配置.其实具体的用法最好还是看官方文档. ...
- JavaScript日历控件开发 C# 读取 appconfig文件配置数据库连接字符串,和配置文件 List<T>.ForEach 调用异步方法的意外 ef 增加或者更新的习惯思维 asp.net core导入excel 一个二级联动
JavaScript日历控件开发 概述 在开篇之前,先附上日历的代码地址和演示地址,代码是本文要分析的代码,演示效果是本文要实现的效果代码地址:https://github.com/aspwebc ...
- 深入理解Java中配置环境变量
深入理解Java中配置环境变量 配置的目的: 本来只在安装JDK的bin目下能运行java.exe,javac.exe,jar.exe,javadoc.exe等Java开发工具包命令,我们现在想让在所 ...
- Apache 中httpd.conf文件配置详解(转载)
httpd.conf文件配置详解 Apache的基本设置主要交由httpd.conf来设定管理,我们要修改Apache的相关设定,主要还是通过修改httpd.cong来实现.下面让我们来看看htt ...
- 对vue中 默认的 config/index.js:配置的详细理解 -【以及webpack配置的理解】-config配置的目的都是为了服务webpack的配置,给不同的编译条件提供配置
当我们需要和后台分离部署的时候,必须配置config/index.js: 用vue-cli 自动构建的目录里面 (环境变量及其基本变量的配置) var path = require('path') ...
随机推荐
- (十)、cat--查看文件命令
一.命令描述与格式 将文件或标准输入组合输出到标准输出,所以注定了其可以配合管道应用, 格式:cat [选项] [files] 选项: -A --show-all ...
- springboot日志输出到文件
今天来谈一谈日志,主要是说一说springboot的日志,因为最近在学习springboot.首先在写代码的时候,要养成记日志的习惯,这点真的很重要,因为之前吃了很多亏.过去我对日志很不在意,该有的日 ...
- Spring AOP 实战运用
Spring AOP 实战 看了上面这么多的理论知识, 不知道大家有没有觉得枯燥哈. 不过不要急, 俗话说理论是实践的基础, 对 Spring AOP 有了基本的理论认识后, 我们来看一下下面几个具体 ...
- [leetcode]54. Spiral Matrix二维数组螺旋取数
import java.util.ArrayList; import java.util.List; /** * Given a matrix of m x n elements (m rows, n ...
- 【Go】我与sync.Once的爱恨纠缠
原文链接: https://blog.thinkeridea.com/202101/go/exsync/once.html 官方描述 Once is an object that will perfo ...
- 异步技巧之CompletableFuture
摘自--https://juejin.im/post/5b4622df5188251ac9766f47 异步技巧之CompletableFuture 1.Future接口 1.1 什么是Future? ...
- java内部类 之private 属性对其他对象的访问限制
public class InnerClass1 { private class Content { private int i; public int value() { // TODO Auto- ...
- 我是这样理解EventLoop的
我是这样理解EventLoop的 一.前言 众所周知,在使用javascript时,经常需要考虑程序中存在异步的情况,如果对异步考虑不周,很容易在开发中出现技术错误和业务错误.作为一名合格的jav ...
- 关于IP的相关计算
不论是考研还是考各种计算机类的证,大家或多或少都会遇到网络部分的一种题型,大体的归类就是以下几种: 已知一个IP是192.XX.XX.XX,子网掩码是255.255.255.0,那么它的网络地址是多少 ...
- spark bulkload 报错异常:Caused by: java.io.IOException: Added a key not lexically larger than previous
------------恢复内容开始------------ Caused by: java.io.IOException: Added a key not lexically larger than ...