dev-tools
OS
Linux
文件,用户,内存,磁盘,进程,网络,服务,日志
内核,命令,Shell,vim
软件包,安装,环境变量,
Docker
# ubuntu22默认使用 snap安装docker
sudo snap install docker
# 安装完成之后,启动docker
sudo snap start docker
# 查看docker 状态
snap services
# 配置镜像加速地址
vi /var/snap/docker/471/config/daemon.json
```json
// 网易镜像
{
"registry-mirrors": [
"https://registry.docker-cn.com",
"http://hub-mirror.c.163.com",
"https://docker.mirrors.ustc.edu.cn"
]
}
Windows
cmd乱码: chcp | Microsoft Learn
开机自动网页登录:
- copy curl
- paste in .bat
- 计算机管理-任务计划程序-创建任务
git
工作区,暂存区
分支,合并,冲突
clone, pull, push, reset, 回退
标签
cherry-pick
Git Flow
amend : 将未提交到版本库里的文件提交到版本库,并合并提交记录
Maven
itsoku.maven
Maven – Download Apache Maven
https://maven.apache.org/guides/index.html
使用方式
安装
- 安装Maven
下载解压
IDEA 自带Maven,位于下,如果不使用IDEA内置Maven,需要在IDEA-Settings-Maven 下配置Maven 路径
外部配置
配置环境变量
MAVEN_HOME 为Maven路径,path 中添加 %MAVEN_HOME%\bin
settings.xml
- 配置 Maven/conf/settings.xml
- 配置生效顺序
mvn clean -X # -X 打印Maven debug信息,
优先读取`Maven/conf/settings.xml`,如果没有,再读取`User/ .m2\settings.xml`,还没有报错。即,使用命令行打包时,与IDEA的配置无关。
[DEBUG] Reading global settings from D:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.2.3\plugins\maven\lib\maven3\bin\..\conf\settings.xml
[DEBUG] Reading user settings from C:\Users\EDY\ .m2\settings.xml
- 配置
settings.xml中
<localRepository> 配置本地依赖的目录
<profiles> 做环境区分,内可配repositories远程仓库,<activeProfiles> 设置profiles默认生效。
<mirrors> 配置仓库镜像,
<mirrors>
<mirror>
<id>aliyunmaven</id>
<mirrorOf>central</mirrorOf>
<name>阿里云公共仓库</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
</mirrors>
仓库读取顺序:本地仓库>镜像>私服
configuring-maven
https://maven.apache.org/guides/mini/guide-mirror-settings.html
应用配置 pom.xml
- 创建Maven项目,配置pom.xml
Maven使用固定的目录结构,打包路径为target,源代码路径(Sources ROOT)src/main/java,测试代码路径src/test/java(Resources ROOT) ,在IDEA中有特定的图标标识。
pom配置注释 - 项目版本
version分为开发版本(Snapshot)和发布版本(Release):A依赖B的Snapshot版本。每次B升级发布会在仓库中生成带有时间戳的Snapshot版本。A构建的时候会自动下载B最新时间戳的Snapshot版本 - 项目名
create module - name : ha Maven侧边栏名
- location:
d:\demo\haa等同于在父pom中声明的module名,模块名 - artifactId:haaa
Maven多模块
Inheritance和Aggregation可以一起使用
Project Inheritance 可将子模块中共同的配置集成到父项目中,实现方式是在模块中指定父pom
maven坐标和仓库对应的映射关系:[groupId]\[artifactId]\[version]\[artifactId]-[version].jar
<!-- module -->
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<!--指定版本<version>,排除版本<exclusions>-->
<version>1</version>
<!--父pom不是项目的一级子目录,需指明相对路径-->
<relativePath>../parent/pom.xml</relativePath>
</parent>
<!-- module坐标 省去groupId,version-->
<artifactId>my-module</artifactId>
</project>
Project Aggregation 可只在父项目中构建整个项目,实现方式是在父项目中指定模块
<!-- app -->
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
<packaging>pom</packaging>
<modules>
<!--父pom不是项目的一级子目录,需指明相对路径-->
<module>../my-module</module>
</modules>
</project>
依赖
dependencyManagement dependencies
dependencyManagement 里面配置的依赖,子模块也可以用,子模块可以只声明 groupId and artifactId
spring-boot依赖配置
https://docs.spring.io/spring-boot/docs/2.6.1/maven-plugin/reference/htmlsingle/#
- 将项目配置为从
spring-boot-starter-parent继承。就可以使用SB的依赖管理和插件管理。
可以继承插件管理,改变依赖项SB内置的依赖项版本时,可以在<properties>中修改版本号。<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.6.1</version> </parent> - 如果不想使用
spring-boot-starter-parent,可以使用import scope 标识的依赖项spring-boot-dependencies,来使用SB的依赖管理。
不可以继承插件管理,改变依赖项SB内置的依赖项版本时,需要在spring-boot-dependencies声明前重新添加依赖。<dependencyManagement> <dependencies> <dependency> <!-- Import dependency management from Spring Boot --> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>2.6.1</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement>
maven classifier https://blog.csdn.net/fu_zhongyuan/article/details/90602356
缺点:
依赖的范围:scope
classpath和jar关系详解:http://www.itsoku.com/article/234
JVM通过环境变量classpath决定搜索class的路径(默认是当前目录)和顺序;jar包中的MANIFEST.MF是纯文本,可以指定Main-Class和其它信息,可以jar -jar 运行程序。 scope是用来控制被依赖的构件与classpath的关系(编译、打包、运行所用到的classpath)。scope指明依赖项会不会被打进jar包。
- compile,默认值,编译,测试,运行(运行才会被打包)
- provided,编译、测试
- runtime,测试、运行
- test,测试
- system,本地仓库以外的jar
- import:导入POM文件中的依赖管理部分,而不实际引入这些依赖项。通常用于将其他项目作为BOM(Bill of Materials,材料清单)进行引用,与
dependencyManagement合用
统一管理依赖版本 properties
声明在父pom中,可用于项目中的所有模块,使用${} 方式进行引用
依赖的特性
- 传递性 2. 路径最短者优先(依赖树(mvn dependency:tree)) 3. 路径相同,pom中先声明优先
编译打包
使用插件实现,插件与生命周期绑定
编译器插件在构建中的作用查看 Introduction to the Build Lifecycle. 查看可用的插件 Plugins List ,如何使用插件查看 Guide to Configuring Plugins.
maven打包添加git commit id 参考
spring-boot/docs/2.4.1/maven-plugin
maven。 mvn clean package -Dmaven.test.skip=true -P prod
mvn package spring-boot:repackage 会保留不用的配置文件
[插件目标]声明[构建阶段]实现方式,[构建阶段]组成[生命周期]。 http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
项目名,项目资源,构建插件maven-compiler-plugin;maven-resources-plugin;maven-war-plugin,war包名
构建阶段:
[1] 清理clean:delete .class
[2] 编译compile:.java->.class
[3] 测试test:自动测试,自动调用junit程序
[4] 报告report:测试结果
[5] 打包package:动态Web工程打War包,java工程打jar包 构件文件名:[artifactId][-verion][-classifier].[type]
[6] 安装install:jar/war copy to 本地仓库。传到本地仓库
[7] 部署deploy:将war放入web容器下, 传到私服
多环境配置 profile
命令
mvn -h
-D,--define <arg> **Define** a system property
-P,--activate-profiles <arg> Comma-delimited list of **profiles**
-X -- 打印debug日志
-DskipTests,不执行测试用例,但编译测试用例类生成相应的class文件至target/test-classes下。
-Dmaven.test.skip=true,不执行测试用例,也不编译测试用例类。https://blog.csdn.net/arkblue/article/details/50974957)
配合IDEA Maven侧边栏Profiles 一起用
mvn clean package -Dmaven.test.skip=true -U
QA
Q:
编译错误:
java: 无法访问org.hibernate.validator.group.GroupSequenceProvider
错误的类文件: /D:/repository/repository-e/org/hibernate/validator/hibernate-validator/8.0.0.Final/hibernate-validator-8.0.0.Final.jar!/org/hibernate/validator/group/GroupSequenceProvider.class
类文件具有错误的版本 55.0, 应为 52.0
请删除该文件或确保该文件位于正确的类路径子目录中。
A:hibernate8 需要 JDK11,Releases - Hibernate Validator 确认版本关系
Q:
SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details.
SLF4J: Class path contains SLF4J bindings targeting slf4j-api versions 1.7.x or earlier.
SLF4J: Ignoring binding found at [jar:file:/D:/repository/repository-e/ch/qos/logback/logback-classic/1.2.11/logback-classic-1.2.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See https://www.slf4j.org/codes.html#ignoredBindings for an explanation.
A:slf4j-api 版本 超出 2.0,与 logback 版本不兼容
Q:
YAMLException: java.nio.charset.MalformedInputException: Input length = 2
A:文件编码不对
Q: 部署
mvn deploy -DaltDeploymentRepository=snapshots::default::http://hr-nexus.hrfax.cn/nexus/content/repositories/snapshots/
Markdown
文档=内容+形式(排版)。Markdown胜在套用模板,弱化灵活排版。但 图片,表格,转义 功能弱。
word:docx使用OpenXML(OOXML)协议,是一种对象链接和嵌入的技术,该技术可以包含文本,图形,电子表格甚至其他二进制数据。修改.docx为.zip,可以看到 docx的xml组织格式。 ref Word解析之Word内部结构
IDEA
Menus and toolbars | IntelliJ IDEA Documentation (jetbrains.com)
setting
- File
- Settings
- Appearence Theme
- Keymap
- Editor
4. File and Color Templates:Includes File Header 类注释/ Live Template 方法注释
5. File Encodings - Plugins 有些插件只有旗舰版才生效,比如 Groovy
- EasyYapi
- C3P
- Leetcode Editor
- Build
- Maven Maven home path / Local Repository
- Project Settings
- Project:SDK
- Settings
- View
- Appearance
- Status Bur Widgets:Memory Indicator
- Details in Tree View
- Appearance
- VCS
- Get from version Control
- Help
- Help
- Getting started
- KeyBoard shortcuts PDF
- My Productivity
- Edit custom VM options
- About
- 页面
- double shift to search everywhere
- ctrl + 鼠标左键:跳转
- 左键
- refactor
- copy / paste special
快捷键
double shift - classes - project files
ctrl+q preview doc ; esc
ctrl w : select words
ctrl / : 注释单行 ; ctrl shift / 多行
ctrl D : copy lines ; shift ↑ 选择多行
ctrl shift ↑ : 移动行 / 方法
ctrl - : 折叠方法 ; ctrl = 展开方法 ;ctrl shift - : 折叠所有方法
postfix .
ctrl shift enter 补全
shift f9 改名
ctrl alt m 提取方法
ctrl alt shift t : refactor
ctrl alt L : format
ctrl p : see method siginal ; ctrl q method info ; ctrl shift i : method impl ; alt 7 : see method defination ; ctrl h :see hierarcy
ctrl e : recent files
alt 9 : git history
f2 : see next error
notepad
a editor under Windows with syntax highlighting and code folding.
Editor
Column Mode
If you copy/cut in column mode, then you copy/cut a rectangle of text 文本矩形
Multi-Editing mode
Ctrl+单击:对每个附加光标进行多个光标选择。 这允许在多个位置执行相同的编辑操作(键入、复制/剪切/粘贴/删除、箭头浏览文本)
Dual View 双视图
Clone Document
The cloned document is the same document as its original one, but with the separated views.
\s+$
DBeaver
密码解密 https://github.com/geekyouth/crack-dbeaver-password.git
源文件在DBeaver的工作空间中,随便打开一个SQL文件就可以到工作空间。xxx-space\General\.dbeaver\credentials-config.json
SQL Templates · dbeaver/dbeaver Wiki · GitHub
Database Structure Diagrams · dbeaver/dbeaver Wiki · GitHub
refresh f5
ctrl+shift+f format
mysql - 如何将DBeaver的语言强行锁定至英语? - SegmentFault 思否
在 Windows 中,通过修改图标属性中的目标参数,可以向快捷方式或可执行文件添加额外的参数。这些参数会在程序执行时传递给应用程序,从而影响其行为或配置。添加参数的格式是 "C:\Program Files\MyApp\app.exe" --option1 value1 --option2 value2
"D:\Program Files\DBeaver\dbeaver.exe" -nl zh
zh 表示中文,en 表示英文
图
时序图-startuml
其他图-drawio
drawio连gitlab
禅道
产线问题处理工具。设置独立空间进行维护。
产线问题空间路径如下:测试 → bug→ 产线问题工单
重现步骤:关联的订单,问题的截图,操作步骤等
产线问题排查:数据,日志,代码