Nexus笔记

Nexus作为私有仓库,可以用来存储jar、aar、js库,一般公司内可以搭建一个用来存储共用的库,一来可以提升同步时间,一来统一管理基础库,提升开发效率。

搭建环境

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

# 下载安装包
https://www.sonatype.com/products/sonatype-nexus-oss

# 解压到$HOME/tools文件夹下

# 设置软链
ls -s /Users/liuyunxia/tools/nexus-3.55.0-01-mac/nexus-3.55.0-01 /Users/liuyunxia/tools/nexus-3.55.0-01-mac/nexus-latest


# 往 ~/.bash_profile 文件添加如下两行
export NEXUS_HOME=/Users/liuyunxia/tools/nexus-3.55.0-01-mac/nexus-latest
PATH=$PATH:$NEXUS_HOME/bin

# 执行如下命令使添加到 ~/.profile 文件的配置生效
source ~/.bash_profile



nexus start
nexus stop
nexus restart


1
2
3
4
5
6
7
# 错误
Unrecognized option: --add-reads=java.xml=java.logging
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

# 解决
配置java路径,打开nexus文件,配置INSTALL4J_JAVA_HOME_OVERRIDE=/Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk

Read More

BuildContext

BuildContext

BuildContext就是Widget对应的Element。

WidgetsFlutterBinding,其在创建的时候绑定了

如果Widget有更新,需要重新布局,Framework会将需要布局的RenderObject加入PipelineOwner的_nodesNeedingLayout中,然后当下一个VSync信号来临时,Framework会遍历_nodesNeedingLayout,对其中的每一个RenderObject重新进行布局,遍历_nodesNeedingLayout的函数。

前端模块化概念

在NodeJS之前,由于没有过于复杂的开发场景,前端是不存在模块化的,后端才有模块化。NodeJS诞生之后,它使用CommonJS的模块化规范。从此,js模块化开始快速发展。

CommonJS

Node.js是commonJS规范的主要实践者,它有四个重要的环境变量为模块化的实现提供支持:module、exports、require、global。实际使用时,用module.exports定义当前模块对外输出的接口(不推荐直接用exports),用require加载模块。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// 定义模块math.js
var basicNum = 0;
function add(a, b) {
return a + b;
}
module.exports = { //在这里写上需要向外暴露的函数、变量
add: add,
basicNum: basicNum
}

// 引用自定义的模块时,参数包含路径,可省略.js
var math = require('./math');
math.add(2, 5);

// 引用核心模块时,不需要带路径
var http = require('http');
http.createService(...).listen(3000);

AMD

AMD规范采用异步方式加载模块,模块的加载不影响它后面语句的运行。所有依赖这个模块的语句,都定义在一个回调函数中,等到加载完成之后,这个回调函数才会运行。

Read More