From 625da32fed58ad0b50ac4cdaeb329d69d05e480b Mon Sep 17 00:00:00 2001 From: nicksxs Date: Sun, 16 Feb 2020 14:31:54 +0800 Subject: [PATCH] Site updated: 2020-02-16 14:31:53 --- 2014/12/23/my-new-post/index.html | 8 +- 2014/12/24/MFC 模态对话框/index.html | 12 +- 2014/12/30/Clone-Graph-Part-I/index.html | 22 +- 2015/01/04/Path-Sum/index.html | 10 +- 2015/01/14/Two-Sum/index.html | 10 +- .../index.html | 14 +- 2015/03/11/Number-Of-1-Bits/index.html | 12 +- 2015/03/11/Reverse-Bits/index.html | 10 +- 2015/03/13/Reverse-Integer/index.html | 10 +- 2015/04/14/Add-Two-Number/index.html | 12 +- 2015/04/15/Leetcode-No-3/index.html | 12 +- 2015/06/22/invert-binary-tree/index.html | 10 +- 2016/07/13/swoole-websocket-test/index.html | 8 +- 2016/08/14/34-Search-for-a-Range/index.html | 12 +- 2016/08/14/docker-mysql-cluster/index.html | 8 +- 2016/09/29/binary-watch/index.html | 10 +- .../minimum-size-subarray-sum-209/index.html | 10 +- 2016/10/12/summary-ranges-228/index.html | 12 +- .../index.html | 8 +- 2017/03/28/spark-little-tips/index.html | 8 +- 2017/04/25/rabbitmq-tips/index.html | 8 +- 2017/05/09/ambari-summary/index.html | 8 +- 2019/06/18/openresty/index.html | 8 +- .../23/AbstractQueuedSynchronizer/index.html | 8 +- 2019/12/07/JVM-G1-Part-1/index.html | 11 +- 2019/12/10/Redis-Part-1/index.html | 8 +- 2019/12/18/1Q84读后感/index.html | 8 +- .../聊聊Java中的单例模式/index.html | 8 +- 2019/12/26/redis数据结构介绍/index.html | 20 +- .../04/redis数据结构介绍二/index.html | 20 +- .../10/redis数据结构介绍三/index.html | 20 +- .../19/redis数据结构介绍四/index.html | 20 +- .../20/redis数据结构介绍五/index.html | 20 +- .../22/redis数据结构介绍六/index.html | 20 +- 2020/02/01/2019年终总结/index.html | 8 +- 2020/02/09/G1收集器概述/index.html | 16 +- 2020/02/16/Maven实用小技巧/index.html | 674 ++++++++++++++++++ 404.html | 8 +- 404/index.html | 8 +- archives/2014/12/index.html | 10 +- archives/2014/index.html | 10 +- archives/2015/01/index.html | 10 +- archives/2015/03/index.html | 10 +- archives/2015/04/index.html | 10 +- archives/2015/06/index.html | 10 +- archives/2015/index.html | 10 +- archives/2016/07/index.html | 10 +- archives/2016/08/index.html | 10 +- archives/2016/09/index.html | 10 +- archives/2016/10/index.html | 10 +- archives/2016/11/index.html | 10 +- archives/2016/index.html | 10 +- archives/2017/03/index.html | 10 +- archives/2017/04/index.html | 10 +- archives/2017/05/index.html | 10 +- archives/2017/index.html | 10 +- archives/2019/06/index.html | 10 +- archives/2019/09/index.html | 10 +- archives/2019/12/index.html | 10 +- archives/2019/index.html | 10 +- archives/2020/01/index.html | 10 +- archives/2020/02/index.html | 30 +- archives/2020/index.html | 30 +- archives/index.html | 50 +- archives/page/2/index.html | 50 +- archives/page/3/index.html | 50 +- archives/page/4/index.html | 30 +- atom.xml | 87 +-- baidu_verify_Gl8jtoDV4z.html | 8 +- baidusitemap.xml | 15 +- categories/C/Redis/index.html | 8 +- categories/C/index.html | 8 +- categories/Java/Design-Patterns/index.html | 8 +- categories/Java/GC/index.html | 8 +- categories/Java/JVM/index.html | 8 +- categories/Java/Maven/index.html | 512 +++++++++++++ categories/Java/Singleton/index.html | 8 +- categories/Java/index.html | 35 +- categories/Redis/Distributed-Lock/index.html | 8 +- categories/Redis/index.html | 8 +- categories/Redis/数据结构/index.html | 8 +- categories/Redis/源码/index.html | 8 +- categories/data-analysis/index.html | 8 +- categories/docker/index.html | 8 +- categories/index.html | 12 +- categories/leetcode/index.html | 8 +- categories/leetcode/page/2/index.html | 8 +- categories/nginx/index.html | 8 +- categories/php/index.html | 8 +- categories/生活/index.html | 8 +- .../生活/年终总结/2019/index.html | 8 +- categories/生活/年终总结/index.html | 8 +- categories/读后感/index.html | 8 +- categories/读后感/村上春树/index.html | 8 +- css/main.css | 2 +- index.html | 282 ++++---- lib/pace/README.html | 8 +- page/2/index.html | 213 +++--- page/3/index.html | 202 +++--- page/4/index.html | 107 ++- sitemap.xml | 31 +- tags/2019/index.html | 8 +- tags/Design-Patterns/index.html | 8 +- tags/Distributed-Lock/index.html | 8 +- tags/G1/index.html | 8 +- tags/GC/index.html | 8 +- tags/Garbage-First-Collector/index.html | 8 +- tags/JVM/index.html | 8 +- tags/Maven/index.html | 512 +++++++++++++ tags/Redis/index.html | 138 +++- tags/Singleton/index.html | 8 +- tags/aqs/index.html | 8 +- tags/c/index.html | 358 ++++------ tags/c/page/2/index.html | 8 +- tags/cluster/index.html | 8 +- tags/docker/index.html | 8 +- tags/hadoop/index.html | 8 +- tags/im/index.html | 8 +- tags/index.html | 12 +- tags/java/index.html | 112 ++- tags/leetcode/index.html | 8 +- tags/leetcode/page/2/index.html | 8 +- tags/mfc/index.html | 8 +- tags/mq/index.html | 8 +- tags/mysql/index.html | 8 +- tags/nginx/index.html | 8 +- tags/openresty/index.html | 8 +- tags/php/index.html | 8 +- tags/python/index.html | 8 +- tags/spark/index.html | 8 +- tags/swoole/index.html | 8 +- tags/websocket/index.html | 8 +- tags/分布式锁/index.html | 8 +- tags/单例/index.html | 8 +- tags/博客,文章/index.html | 8 +- tags/年终总结/index.html | 8 +- tags/数据结构/index.html | 8 +- tags/源码/index.html | 8 +- tags/生活/index.html | 8 +- tags/设计模式/index.html | 8 +- tags/读后感/index.html | 8 +- 141 files changed, 3361 insertions(+), 1312 deletions(-) create mode 100644 2020/02/16/Maven实用小技巧/index.html create mode 100644 categories/Java/Maven/index.html create mode 100644 tags/Maven/index.html diff --git a/2014/12/23/my-new-post/index.html b/2014/12/23/my-new-post/index.html index eb89e29f5b..43229f3b07 100644 --- a/2014/12/23/my-new-post/index.html +++ b/2014/12/23/my-new-post/index.html @@ -436,20 +436,20 @@
- 36 + 37 posts
- 23 + 24 categories
- 40 + 41 tags
@@ -474,7 +474,7 @@
diff --git a/2014/12/24/MFC 模态对话框/index.html b/2014/12/24/MFC 模态对话框/index.html index 95c69b6188..39f9c38e67 100644 --- a/2014/12/24/MFC 模态对话框/index.html +++ b/2014/12/24/MFC 模态对话框/index.html @@ -308,7 +308,7 @@ @@ -459,20 +459,20 @@
- 36 + 37 posts
- 23 + 24 categories
- 40 + 41 tags
@@ -497,7 +497,7 @@
diff --git a/2014/12/30/Clone-Graph-Part-I/index.html b/2014/12/30/Clone-Graph-Part-I/index.html index f9b971a3b3..82b488941f 100644 --- a/2014/12/30/Clone-Graph-Part-I/index.html +++ b/2014/12/30/Clone-Graph-Part-I/index.html @@ -61,8 +61,8 @@ - + @@ -307,19 +307,19 @@ @@ -363,8 +363,8 @@ @@ -475,20 +481,20 @@
- 36 + 37 posts
- 23 + 24 categories
- 40 + 41 tags
@@ -513,7 +519,7 @@
diff --git a/2020/02/16/Maven实用小技巧/index.html b/2020/02/16/Maven实用小技巧/index.html new file mode 100644 index 0000000000..a48c2672d0 --- /dev/null +++ b/2020/02/16/Maven实用小技巧/index.html @@ -0,0 +1,674 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Maven实用小技巧 | Nicksxs's Blog + + + + + + + + + + + + + + + + +
+
+ +
+
+
+ + +

What hurts more, the pain of hard work or the pain of regret?

+
+ + +
+ + + +
+
+ + +
+ + 0% +
+ + + + +
+
+
+ + +
+ + +
+ + + +
+ + + + + +
+

+ Maven实用小技巧 +

+ + +
+ + + + +
+ + +

Maven 翻译为”专家”、”内行”,是 Apache 下的一个纯 Java 开发的开源项目。基于项目对象模型(缩写:POM)概念,Maven利用一个中央信息片断能管理一个项目的构建、报告和文档等步骤。

+

Maven 是一个项目管理工具,可以对 Java 项目进行构建、依赖管理。

+

Maven 也可被用于构建和管理各种项目,例如 C#,Ruby,Scala 和其他语言编写的项目。Maven 曾是 Jakarta 项目的子项目,现为由 Apache 软件基金会主持的独立 Apache 项目。

+

maven也是我们日常项目中实用的包管理工具,相比以前需要用把包下载下来,放进 lib 中,在平时工作中使用的话,其实像 idea 这样的 ide 工具都会自带 maven 工具和插件

+

maven的基本操作

    +
  • mvn -v
    查看 maven 信息
  • +
  • mvn compile
    将 Java 编译成 class 文件
  • +
  • mvn test
    执行 test 包下的测试用例
  • +
  • mvn package
    将项目打成 jar 包
  • +
  • mvn clean
    删除package 在 target 目录下面打出来的 jar 包和 target 目录
  • +
  • mvn install
    将打出来的 jar 包复制到 maven 的本地仓库里
  • +
  • mvn deploy
    将打出来的 jar 包上传到远程仓库里
  • +
+

与 composer 对比

因为我也是个 PHP 程序员,所以对比一下两种语言,很容易想到在 PHP 的 composer 跟 Java 的 maven 是比较类似的作用,有一点两者是非常相似的,就是原仓库都是因为某些原因连接拉取都会很慢,所以像 composer 会有一些国内源,前阵子阿里也出了一个,类似的 maven 一般也会使用阿里的镜像仓库,通过在 setting.xml 文件中的设置

+
1
2
3
4
5
6
7
8
<mirrors>
<mirror>
<id>aliyun</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
+

这算是个尴尬的共同点,然后因为 PHP 是解释型脚本语言,所以 php 打出来的 composer 包其实就是个 php 代码包,使用SPL Autoload等方式加载代码包,maven 包则是经过编译的 class 包,还有一点是 composer 也可以直接使用 github 地址作为包代码的拉取源,这点也是比较大的区别,maven使用 pom 文件管理依赖

+

maven 的个人小技巧

    +
  • maven 拉取依赖时,同时将 snapshot 也更新了,就是 mvn compile加个-U参数,如果还不行就需要将本地仓库的 snapshot 删掉,
    这个命令的 help 命令解释是 -U,–update-snapshots Forces a check for missing releases and updated snapshots on
    remote repositories,这个在日常使用中还是很经常使用的
  • +
  • maven 出现依赖冲突的时候的解决方法
    首先是依赖分析,使用mvn dependency:tree分析下依赖关系,如果要找具体某个包的依赖引用关系可以使用mvn dependency:tree -Dverbose -Dincludes=org.springframework:spring-webmvc命令进行分析,如果发现有冲突的依赖关系,本身 maven 中依赖引用有相对的顺序,大致来说是引用路径短的优先,pom 文件中定义的顺序优先,如果要把冲突的包排除掉可以在 pom 中用
    1
    2
    3
    4
    5
    6
    <exclusions>
    <exclusion>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    </exclusion>
    </exclusions>
    +将冲突的包排除掉
  • +
  • maven 依赖的 jdk 版本管理
    前面介绍的mvn -v可以查看 maven 的安装信息
    比如
    1
    2
    3
    4
    5
    Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
    Maven home: /usr/local/Cellar/maven/3.6.3_1/libexec
    Java version: 1.8.0_201, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre
    Default locale: zh_CN, platform encoding: UTF-8
    OS name: "mac os x", version: "10.14.6", arch: "x86_64", family: "mac"
    +这里可以看到用了 mac 自带的 jdk1.8,结合我之前碰到的一个问题,因为使用 homebrew 升级了 gradle,而 gradle 又依赖了 jdk13,因为这个 mvn 的 Java version 也变成 jdk13 了,然后 mvn 编译的时候出现了 java.lang.ExceptionInInitializerError: com.sun.tools.javac.code.TypeTags这个问题,所以需要把这个版本给改回来,但是咋改呢,网上搜来的一大堆都是在 pom 文件里的
    source和 target 版本
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    <build>
    <plugins>
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
    <source>1.8</source>
    <target>1.8</target>
    <encoding>UTF-8</encoding>
    </configuration>
    </plugin>
    </plugins>
    <build>
    +或者修改 maven 的 setting.xml中的
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    <profiles>
    <profile>
    <id>ngmm-nexus</id>
    <activation>
    <jdk>1.8</jdk>
    </activation>
    <properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
    </properties>
    </profile>
    </<profiles>>
    +但是这些都没啥用啊,真正有办法的是建个 .mavenrc,这个顾名思义就是 maven 的资源文件,类似于 .bashrc.zshrc,在里面添加 MAVEN_HOME 和 JAVA_HOME,然后执行 source .mavenrc就 OK 啦
  • +
+ +
+ + + + + + + + +
+
请我喝杯咖啡
+ + +
+ + + +
+ +
+ + + + +
+ + + + +
+ + +
+ + +
+
+ +
+
+ + + + +
+ + + + + + + + +
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/404.html b/404.html index f6cb288e66..cef46c91eb 100644 --- a/404.html +++ b/404.html @@ -340,20 +340,20 @@
- 36 + 37 posts
- 23 + 24 categories
- 40 + 41 tags
@@ -378,7 +378,7 @@
diff --git a/404/index.html b/404/index.html index f71a34c0f9..b5ac54bd56 100644 --- a/404/index.html +++ b/404/index.html @@ -327,20 +327,20 @@
- 36 + 37 posts
- 23 + 24 categories
- 40 + 41 tags
@@ -365,7 +365,7 @@
diff --git a/archives/2014/12/index.html b/archives/2014/12/index.html index 563ba35f6d..2d86e6c3ce 100644 --- a/archives/2014/12/index.html +++ b/archives/2014/12/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -368,20 +368,20 @@ @@ -406,7 +406,7 @@ diff --git a/archives/2014/index.html b/archives/2014/index.html index 8b7b9e4b74..5e37669838 100644 --- a/archives/2014/index.html +++ b/archives/2014/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -368,20 +368,20 @@ @@ -406,7 +406,7 @@ diff --git a/archives/2015/01/index.html b/archives/2015/01/index.html index 17607e8288..3b5b4e356f 100644 --- a/archives/2015/01/index.html +++ b/archives/2015/01/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -368,20 +368,20 @@ @@ -406,7 +406,7 @@ diff --git a/archives/2015/03/index.html b/archives/2015/03/index.html index b5350efa65..be5681f905 100644 --- a/archives/2015/03/index.html +++ b/archives/2015/03/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -368,20 +368,20 @@ @@ -406,7 +406,7 @@ diff --git a/archives/2015/04/index.html b/archives/2015/04/index.html index 6143a82cc4..7a8a3c8397 100644 --- a/archives/2015/04/index.html +++ b/archives/2015/04/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -348,20 +348,20 @@ @@ -386,7 +386,7 @@ diff --git a/archives/2015/06/index.html b/archives/2015/06/index.html index 32e9f8c911..631bf37316 100644 --- a/archives/2015/06/index.html +++ b/archives/2015/06/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/archives/2015/index.html b/archives/2015/index.html index 64af8bb4c5..7d714e2eff 100644 --- a/archives/2015/index.html +++ b/archives/2015/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -488,20 +488,20 @@ @@ -526,7 +526,7 @@ diff --git a/archives/2016/07/index.html b/archives/2016/07/index.html index 5b05c95860..eed403533e 100644 --- a/archives/2016/07/index.html +++ b/archives/2016/07/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/archives/2016/08/index.html b/archives/2016/08/index.html index 7609b2b35c..309f25b1b8 100644 --- a/archives/2016/08/index.html +++ b/archives/2016/08/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -348,20 +348,20 @@ @@ -386,7 +386,7 @@ diff --git a/archives/2016/09/index.html b/archives/2016/09/index.html index bf3c2fc4a3..ca92fc1994 100644 --- a/archives/2016/09/index.html +++ b/archives/2016/09/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/archives/2016/10/index.html b/archives/2016/10/index.html index c6bbdbcf3c..d23a110c0f 100644 --- a/archives/2016/10/index.html +++ b/archives/2016/10/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -348,20 +348,20 @@ @@ -386,7 +386,7 @@ diff --git a/archives/2016/11/index.html b/archives/2016/11/index.html index b2bc5f233e..7cab77c43a 100644 --- a/archives/2016/11/index.html +++ b/archives/2016/11/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/archives/2016/index.html b/archives/2016/index.html index 691ea06bef..908e7fb5f6 100644 --- a/archives/2016/index.html +++ b/archives/2016/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -448,20 +448,20 @@ @@ -486,7 +486,7 @@ diff --git a/archives/2017/03/index.html b/archives/2017/03/index.html index bbaec2be03..752ba44af2 100644 --- a/archives/2017/03/index.html +++ b/archives/2017/03/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/archives/2017/04/index.html b/archives/2017/04/index.html index 4d6babe8cb..87273f72f1 100644 --- a/archives/2017/04/index.html +++ b/archives/2017/04/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/archives/2017/05/index.html b/archives/2017/05/index.html index f72b983828..1bd694f4c5 100644 --- a/archives/2017/05/index.html +++ b/archives/2017/05/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/archives/2017/index.html b/archives/2017/index.html index 732f7a7f49..a8893f902a 100644 --- a/archives/2017/index.html +++ b/archives/2017/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -368,20 +368,20 @@ @@ -406,7 +406,7 @@ diff --git a/archives/2019/06/index.html b/archives/2019/06/index.html index 7530a081f3..8ceaa8184f 100644 --- a/archives/2019/06/index.html +++ b/archives/2019/06/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/archives/2019/09/index.html b/archives/2019/09/index.html index 08702d378d..05004425bb 100644 --- a/archives/2019/09/index.html +++ b/archives/2019/09/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/archives/2019/12/index.html b/archives/2019/12/index.html index aedabc4719..c325b5038d 100644 --- a/archives/2019/12/index.html +++ b/archives/2019/12/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -408,20 +408,20 @@ @@ -446,7 +446,7 @@ diff --git a/archives/2019/index.html b/archives/2019/index.html index f27d1e11e0..1e0cf9104d 100644 --- a/archives/2019/index.html +++ b/archives/2019/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -448,20 +448,20 @@ @@ -486,7 +486,7 @@ diff --git a/archives/2020/01/index.html b/archives/2020/01/index.html index e143140139..9b0c6e0c2c 100644 --- a/archives/2020/01/index.html +++ b/archives/2020/01/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -408,20 +408,20 @@ @@ -446,7 +446,7 @@ diff --git a/archives/2020/02/index.html b/archives/2020/02/index.html index 44a0c370d7..647bf5a2a9 100644 --- a/archives/2020/02/index.html +++ b/archives/2020/02/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -234,6 +234,26 @@

2020

+ +
@@ -348,20 +368,20 @@ @@ -386,7 +406,7 @@ diff --git a/archives/2020/index.html b/archives/2020/index.html index 3020bc032f..6658e38f1f 100644 --- a/archives/2020/index.html +++ b/archives/2020/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -234,6 +234,26 @@

2020

+ +
@@ -448,20 +468,20 @@ @@ -486,7 +506,7 @@ diff --git a/archives/index.html b/archives/index.html index 4deab33705..3f0bd7ba74 100644 --- a/archives/index.html +++ b/archives/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -234,6 +234,26 @@

2020

+ +
@@ -417,26 +437,6 @@
- -
@@ -514,20 +514,20 @@ @@ -552,7 +552,7 @@ diff --git a/archives/page/2/index.html b/archives/page/2/index.html index e554903d24..f42e02bfca 100644 --- a/archives/page/2/index.html +++ b/archives/page/2/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -234,6 +234,26 @@

2019

+ +
@@ -420,26 +440,6 @@
- -
@@ -517,20 +517,20 @@ @@ -555,7 +555,7 @@ diff --git a/archives/page/3/index.html b/archives/page/3/index.html index b81fbf2697..817fa1a932 100644 --- a/archives/page/3/index.html +++ b/archives/page/3/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -234,6 +234,26 @@

2016

+ +
@@ -417,26 +437,6 @@
- -
@@ -514,20 +514,20 @@ @@ -552,7 +552,7 @@ diff --git a/archives/page/4/index.html b/archives/page/4/index.html index dc008a2634..7a7ccba597 100644 --- a/archives/page/4/index.html +++ b/archives/page/4/index.html @@ -226,7 +226,7 @@
- OK! 36 posts in total. Keep on posting. + OK! 37 posts in total. Keep on posting.
@@ -234,6 +234,26 @@

2015

+ +
@@ -434,20 +454,20 @@ @@ -472,7 +492,7 @@ diff --git a/atom.xml b/atom.xml index 0a21e8aa4d..aefc5fb7b9 100644 --- a/atom.xml +++ b/atom.xml @@ -6,7 +6,7 @@ - 2020-02-09T12:56:16.421Z + 2020-02-16T06:31:27.589Z https://nicksxs.me/ @@ -16,6 +16,38 @@ Hexo + + Maven实用小技巧 + + https://nicksxs.me/2020/02/16/Maven%E5%AE%9E%E7%94%A8%E5%B0%8F%E6%8A%80%E5%B7%A7/ + 2020-02-16T02:39:42.000Z + 2020-02-16T06:31:27.589Z + + + + + + + + <p>Maven 翻译为”专家”、”内行”,是 Apache 下的一个纯 Java 开发的开源项目。基于项目对象模型(缩写:POM)概念,Maven利用一个中央信息片断能管理一个项目的构建、报告和文档等步骤。</p> +<p>Maven 是一个项目管理工具,可以对 Java + + + + + + + + + + + + + + + + + G1收集器概述 @@ -119,10 +151,10 @@ - - + + @@ -158,10 +190,10 @@ - - + + @@ -197,10 +229,10 @@ - - + + @@ -237,10 +269,10 @@ - - + + @@ -276,10 +308,10 @@ - - + + @@ -315,10 +347,10 @@ - - + + @@ -668,35 +700,6 @@ - - - - - - - - - - - - - - minimum-size-subarray-sum-209 - - https://nicksxs.me/2016/10/11/minimum-size-subarray-sum-209/ - 2016-10-11T14:04:28.000Z - 2020-01-12T13:08:27.008Z - - - - - - - - <h3 id="problem"><a href="#problem" class="headerlink" title="problem"></a>problem</h3><p>Given an array of n positive integers and a - - - diff --git a/baidu_verify_Gl8jtoDV4z.html b/baidu_verify_Gl8jtoDV4z.html index d44867f1ef..c7dd8edf8d 100644 --- a/baidu_verify_Gl8jtoDV4z.html +++ b/baidu_verify_Gl8jtoDV4z.html @@ -329,20 +329,20 @@ @@ -367,7 +367,7 @@ diff --git a/baidusitemap.xml b/baidusitemap.xml index bbd96f530c..bb6f8d19ce 100644 --- a/baidusitemap.xml +++ b/baidusitemap.xml @@ -1,6 +1,9 @@ + https://nicksxs.me/2020/02/16/Maven%E5%AE%9E%E7%94%A8%E5%B0%8F%E6%8A%80%E5%B7%A7/ + 2020-02-16 + https://nicksxs.me/2020/02/09/G1%E6%94%B6%E9%9B%86%E5%99%A8%E6%A6%82%E8%BF%B0/ 2020-02-09 @@ -37,10 +40,10 @@ https://nicksxs.me/2015/03/13/Reverse-Integer/ 2020-01-12 - https://nicksxs.me/2014/12/24/MFC%20%E6%A8%A1%E6%80%81%E5%AF%B9%E8%AF%9D%E6%A1%86/ + https://nicksxs.me/2016/08/14/docker-mysql-cluster/ 2020-01-12 - https://nicksxs.me/2016/08/14/docker-mysql-cluster/ + https://nicksxs.me/2014/12/24/MFC%20%E6%A8%A1%E6%80%81%E5%AF%B9%E8%AF%9D%E6%A1%86/ 2020-01-12 https://nicksxs.me/2017/05/09/ambari-summary/ @@ -64,10 +67,10 @@ https://nicksxs.me/2020/01/10/redis%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%BB%8B%E7%BB%8D%E4%B8%89/ 2020-01-12 - https://nicksxs.me/2014/12/23/my-new-post/ + https://nicksxs.me/2017/03/28/spark-little-tips/ 2020-01-12 - https://nicksxs.me/2017/03/28/spark-little-tips/ + https://nicksxs.me/2014/12/23/my-new-post/ 2020-01-12 https://nicksxs.me/2014/12/30/Clone-Graph-Part-I/ @@ -82,10 +85,10 @@ https://nicksxs.me/2015/06/22/invert-binary-tree/ 2020-01-12 - https://nicksxs.me/2015/01/04/Path-Sum/ + https://nicksxs.me/2017/04/25/rabbitmq-tips/ 2020-01-12 - https://nicksxs.me/2017/04/25/rabbitmq-tips/ + https://nicksxs.me/2015/01/04/Path-Sum/ 2020-01-12 https://nicksxs.me/2015/03/11/Number-Of-1-Bits/ diff --git a/categories/C/Redis/index.html b/categories/C/Redis/index.html index 39617d176c..331f3dcb0c 100644 --- a/categories/C/Redis/index.html +++ b/categories/C/Redis/index.html @@ -451,20 +451,20 @@ @@ -489,7 +489,7 @@ diff --git a/categories/C/index.html b/categories/C/index.html index 76d684a57f..b72daaf11b 100644 --- a/categories/C/index.html +++ b/categories/C/index.html @@ -451,20 +451,20 @@ @@ -489,7 +489,7 @@ diff --git a/categories/Java/Design-Patterns/index.html b/categories/Java/Design-Patterns/index.html index 2a495d6870..f1bb5591f2 100644 --- a/categories/Java/Design-Patterns/index.html +++ b/categories/Java/Design-Patterns/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/categories/Java/GC/index.html b/categories/Java/GC/index.html index 93dce69d2c..b5c550ec49 100644 --- a/categories/Java/GC/index.html +++ b/categories/Java/GC/index.html @@ -351,20 +351,20 @@ @@ -389,7 +389,7 @@ diff --git a/categories/Java/JVM/index.html b/categories/Java/JVM/index.html index 9ebad34796..c0af5df0dd 100644 --- a/categories/Java/JVM/index.html +++ b/categories/Java/JVM/index.html @@ -351,20 +351,20 @@ @@ -389,7 +389,7 @@ diff --git a/categories/Java/Maven/index.html b/categories/Java/Maven/index.html new file mode 100644 index 0000000000..54bf298c3d --- /dev/null +++ b/categories/Java/Maven/index.html @@ -0,0 +1,512 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Category: Maven | Nicksxs's Blog + + + + + + + + + + + + + + + + +
+
+ +
+
+
+ + +

What hurts more, the pain of hard work or the pain of regret?

+
+ + +
+ + + +
+
+ + +
+ + 0% +
+ + + + +
+
+
+ + +
+ + + + + +
+
+
+

Maven + Category +

+
+ + +
+

2020

+
+ + + +
+
+ + + + + + + + +
+ + + + +
+ + + + + + + + +
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/categories/Java/Singleton/index.html b/categories/Java/Singleton/index.html index 7ed2f3f516..bd4053abe7 100644 --- a/categories/Java/Singleton/index.html +++ b/categories/Java/Singleton/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/categories/Java/index.html b/categories/Java/index.html index 34555fc73b..3697498eeb 100644 --- a/categories/Java/index.html +++ b/categories/Java/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ @@ -510,7 +510,32 @@ -s.js"> +pan> + Nicksxs +
+ + + + + + + + + + +
+ +
+ + + + + + + + + + diff --git a/categories/Redis/Distributed-Lock/index.html b/categories/Redis/Distributed-Lock/index.html index 07735fc668..8d243e75af 100644 --- a/categories/Redis/Distributed-Lock/index.html +++ b/categories/Redis/Distributed-Lock/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/categories/Redis/index.html b/categories/Redis/index.html index fe5ef792da..abc0b79895 100644 --- a/categories/Redis/index.html +++ b/categories/Redis/index.html @@ -451,20 +451,20 @@ @@ -489,7 +489,7 @@ diff --git a/categories/Redis/数据结构/index.html b/categories/Redis/数据结构/index.html index 80548e55e5..ed9b103f39 100644 --- a/categories/Redis/数据结构/index.html +++ b/categories/Redis/数据结构/index.html @@ -431,20 +431,20 @@ @@ -469,7 +469,7 @@ diff --git a/categories/Redis/源码/index.html b/categories/Redis/源码/index.html index bb98f3feae..f6ae7f2bc8 100644 --- a/categories/Redis/源码/index.html +++ b/categories/Redis/源码/index.html @@ -431,20 +431,20 @@ @@ -469,7 +469,7 @@ diff --git a/categories/data-analysis/index.html b/categories/data-analysis/index.html index 98665dd57a..9b5f86796b 100644 --- a/categories/data-analysis/index.html +++ b/categories/data-analysis/index.html @@ -348,20 +348,20 @@ @@ -386,7 +386,7 @@ diff --git a/categories/docker/index.html b/categories/docker/index.html index 6c150b7581..8b3c45ace3 100644 --- a/categories/docker/index.html +++ b/categories/docker/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/categories/index.html b/categories/index.html index dbc6adb356..5d6f112760 100644 --- a/categories/index.html +++ b/categories/index.html @@ -247,10 +247,10 @@
@@ -330,20 +330,20 @@ @@ -368,7 +368,7 @@ diff --git a/categories/leetcode/index.html b/categories/leetcode/index.html index dde18b59d8..35c3a4049b 100644 --- a/categories/leetcode/index.html +++ b/categories/leetcode/index.html @@ -514,20 +514,20 @@ @@ -552,7 +552,7 @@ diff --git a/categories/leetcode/page/2/index.html b/categories/leetcode/page/2/index.html index 0550ce068a..bd9af499c8 100644 --- a/categories/leetcode/page/2/index.html +++ b/categories/leetcode/page/2/index.html @@ -374,20 +374,20 @@ @@ -412,7 +412,7 @@ diff --git a/categories/nginx/index.html b/categories/nginx/index.html index b35699cc33..075b538767 100644 --- a/categories/nginx/index.html +++ b/categories/nginx/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/categories/php/index.html b/categories/php/index.html index 4f22cf19bc..25047cca4f 100644 --- a/categories/php/index.html +++ b/categories/php/index.html @@ -371,20 +371,20 @@ @@ -409,7 +409,7 @@ diff --git a/categories/生活/index.html b/categories/生活/index.html index 85f2303055..d21dc8c88f 100644 --- a/categories/生活/index.html +++ b/categories/生活/index.html @@ -351,20 +351,20 @@ @@ -389,7 +389,7 @@ diff --git a/categories/生活/年终总结/2019/index.html b/categories/生活/年终总结/2019/index.html index 3c4fe2a4ba..07a10bd4fc 100644 --- a/categories/生活/年终总结/2019/index.html +++ b/categories/生活/年终总结/2019/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/categories/生活/年终总结/index.html b/categories/生活/年终总结/index.html index 4cf96f6297..541bf9dc4d 100644 --- a/categories/生活/年终总结/index.html +++ b/categories/生活/年终总结/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/categories/读后感/index.html b/categories/读后感/index.html index 4186ecbe1f..f5b10a7e83 100644 --- a/categories/读后感/index.html +++ b/categories/读后感/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/categories/读后感/村上春树/index.html b/categories/读后感/村上春树/index.html index cdc0858668..f453a53513 100644 --- a/categories/读后感/村上春树/index.html +++ b/categories/读后感/村上春树/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/css/main.css b/css/main.css index 8f30c72158..7f46239849 100644 --- a/css/main.css +++ b/css/main.css @@ -1259,7 +1259,7 @@ pre .javascript .function { } .links-of-author a::before, .links-of-author span.exturl::before { - background: #ffee09; + background: #49ff20; border-radius: 50%; content: ' '; display: inline-block; diff --git a/index.html b/index.html index 4ae56314de..ae73ca6d00 100644 --- a/index.html +++ b/index.html @@ -223,6 +223,122 @@ +
+ + + + + +
+

+ + +

+ + +
+ + + + +
+ + +

Maven 翻译为”专家”、”内行”,是 Apache 下的一个纯 Java 开发的开源项目。基于项目对象模型(缩写:POM)概念,Maven利用一个中央信息片断能管理一个项目的构建、报告和文档等步骤。

+

Maven 是一个项目管理工具,可以对 Java 项目进行构建、依赖管理。

+

Maven 也可被用于构建和管理各种项目,例如 C#,Ruby,Scala 和其他语言编写的项目。Maven 曾是 Jakarta 项目的子项目,现为由 Apache 软件基金会主持的独立 Apache 项目。

+

maven也是我们日常项目中实用的包管理工具,相比以前需要用把包下载下来,放进 lib 中,在平时工作中使用的话,其实像 idea 这样的 ide 工具都会自带 maven 工具和插件

+

maven的基本操作

    +
  • mvn -v
    查看 maven 信息
  • +
  • mvn compile
    将 Java 编译成 class 文件
  • +
  • mvn test
    执行 test 包下的测试用例
  • +
  • mvn package
    将项目打成 jar 包
  • +
  • mvn clean
    删除package 在 target 目录下面打出来的 jar 包和 target 目录
  • +
  • mvn install
    将打出来的 jar 包复制到 maven 的本地仓库里
  • +
  • mvn deploy
    将打出来的 jar 包上传到远程仓库里
  • +
+

与 composer 对比

因为我也是个 PHP 程序员,所以对比一下两种语言,很容易想到在 PHP 的 composer 跟 Java 的 maven 是比较类似的作用,有一点两者是非常相似的,就是原仓库都是因为某些原因连接拉取都会很慢,所以像 composer 会有一些国内源,前阵子阿里也出了一个,类似的 maven 一般也会使用阿里的镜像仓库,通过在 setting.xml 文件中的设置

+
1
2
3
4
5
6
7
8
<mirrors>
<mirror>
<id>aliyun</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
+

这算是个尴尬的共同点,然后因为 PHP 是解释型脚本语言,所以 php 打出来的 composer 包其实就是个 php 代码包,使用SPL Autoload等方式加载代码包,maven 包则是经过编译的 class 包,还有一点是 composer 也可以直接使用 github 地址作为包代码的拉取源,这点也是比较大的区别,maven使用 pom 文件管理依赖

+

maven 的个人小技巧

    +
  • maven 拉取依赖时,同时将 snapshot 也更新了,就是 mvn compile加个-U参数,如果还不行就需要将本地仓库的 snapshot 删掉,
    这个命令的 help 命令解释是 -U,–update-snapshots Forces a check for missing releases and updated snapshots on
    remote repositories,这个在日常使用中还是很经常使用的
  • +
  • maven 出现依赖冲突的时候的解决方法
    首先是依赖分析,使用mvn dependency:tree分析下依赖关系,如果要找具体某个包的依赖引用关系可以使用mvn dependency:tree -Dverbose -Dincludes=org.springframework:spring-webmvc命令进行分析,如果发现有冲突的依赖关系,本身 maven 中依赖引用有相对的顺序,大致来说是引用路径短的优先,pom 文件中定义的顺序优先,如果要把冲突的包排除掉可以在 pom 中用
    1
    2
    3
    4
    5
    6
    <exclusions>
    <exclusion>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    </exclusion>
    </exclusions>
    +将冲突的包排除掉
  • +
  • maven 依赖的 jdk 版本管理
    前面介绍的mvn -v可以查看 maven 的安装信息
    比如
    1
    2
    3
    4
    5
    Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
    Maven home: /usr/local/Cellar/maven/3.6.3_1/libexec
    Java version: 1.8.0_201, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre
    Default locale: zh_CN, platform encoding: UTF-8
    OS name: "mac os x", version: "10.14.6", arch: "x86_64", family: "mac"
    +这里可以看到用了 mac 自带的 jdk1.8,结合我之前碰到的一个问题,因为使用 homebrew 升级了 gradle,而 gradle 又依赖了 jdk13,因为这个 mvn 的 Java version 也变成 jdk13 了,然后 mvn 编译的时候出现了 java.lang.ExceptionInInitializerError: com.sun.tools.javac.code.TypeTags这个问题,所以需要把这个版本给改回来,但是咋改呢,网上搜来的一大堆都是在 pom 文件里的
    source和 target 版本
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    <build>
    <plugins>
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
    <source>1.8</source>
    <target>1.8</target>
    <encoding>UTF-8</encoding>
    </configuration>
    </plugin>
    </plugins>
    <build>
    +或者修改 maven 的 setting.xml中的
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    <profiles>
    <profile>
    <id>ngmm-nexus</id>
    <activation>
    <jdk>1.8</jdk>
    </activation>
    <properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
    </properties>
    </profile>
    </<profiles>>
    +但是这些都没啥用啊,真正有办法的是建个 .mavenrc,这个顾名思义就是 maven 的资源文件,类似于 .bashrc.zshrc,在里面添加 MAVEN_HOME 和 JAVA_HOME,然后执行 source .mavenrc就 OK 啦
  • +
+ + +
+ + + + + + +
+
+
+
+ + + + + + +
@@ -499,14 +615,14 @@ , - , - , @@ -631,14 +747,14 @@ , - , - , @@ -749,14 +865,14 @@ , - , - , @@ -876,14 +992,14 @@ , - , - , @@ -999,14 +1115,14 @@ , - , - , @@ -1119,14 +1235,14 @@ , - , - , @@ -1302,116 +1418,6 @@ - - - -
- - - - - -
-

- - -

- - -
- - - - -
- - -

看完了村上春树的《1Q84》,这应该是第五本看的他的书了,继 跑步,挪威的森林,刺杀骑士团长,海边的卡夫卡之后,不是其中最长的,好像是海边的卡夫卡还是刺杀骑士团长比较长一点,都是在微信读书上看的,比较方便,最开始在上面看的是高晓松的《鱼羊野史》,不知道为啥取这个名字,但是还是满吸引我的,不过由于去年的种种,没有很多心思把它看完,而且本身的组织形式就是比较松散的,看到哪算哪,其实一些野史部分是我比较喜欢,有些谈到人物的就不太有兴趣,而且类似于大祥哥吃的东西,反正都是哇,怎么这么好吃,嗯,太爱(niu)你(bi)了,高晓松就是这个人是我最喜欢的 xxx 家,我也没去细究过他有没有说重复过,反正是不太爱,后来因为这书还一度对战争史有了浓厚的兴趣,然而事实告诉我,大部头的战争史,其实正史我是真的啃不下去,我可能只对其中 10%的内容感兴趣,不过终于也在今年把它看完了,好像高晓松的晓说也最终季了,貌似其中讲朝鲜战争的还被和谐了,看样子是说出了一些故事(truth)。

-

本来只是想把 《1Q84》的读后感写下,现在觉得还是把这篇当成我今年的读书总结吧,不过先从《1Q84》说起。

-

严格来讲,这不是很书面化的读后感,可能我想写的也只是像聊天一样的说下我读过的书,包括的技术博客其实也是类似的,以后或许会转变,但是目前水平如此吧,写多了可能会变好,也可能不会。

-

开始正文吧,这书有点类似于海边的卡夫卡,一开始是通过两条故事线,穿插着叙述,一条是青豆的,不算是个职业杀手的女杀手,要去解决一个经常家暴的斯文败类,穿着描述得比较性感吧,杀人方式是通过比较长的细针,从脖子后面一个精巧的位置插入,可以造成是未知原因死亡的假象,可能会推断成心梗之类的,这里有个前置的细节,就是青豆是乘坐一辆很高级的出租车,内饰什么的都非常有质感,有点不像一辆出租车,然后车里放了一首比较小众的歌,雅纳切克的《小交响曲》,但是青豆知道它,这跟后面的情节也有些许关系,这是女主人公青豆的出场;相应的男主的出场印象不是太深刻,男主叫天吾,是个不知名的作家,跟一个叫小松的编辑有比较好的关系,虽然天吾还没有拿到比较有分量的奖项,但是小松很看好他,也让他帮忙审校一个新作家奖的投稿文章,虽然天吾自身还没获得过这个奖,天吾还有个正式工作,是当数学老师,天吾在学生时代是个数学天才,但后面有对文学产生了兴趣,文学还不足以养活自己,靠着教课还是能保持温饱;

-

接下来是正式故事的起点了,就是小松收到了一部小说投稿,名叫《空气蛹》,是个叫深绘里的女孩子投的稿,小松对他赋予了很高的评价,这里好像记岔了,好像是天吾对这部小说很有好感,但是小松比较怀疑,然后小松看了之后也有了浓厚的兴趣,这里就是开端了,小松想让天吾来重写润色这部《空气蛹》,因为故事本身很有分量,但是描写手法叙事方式等都很拙劣,而天吾正好擅长这个,小松对天吾的评价是,描写技巧无可挑剔,就是故事主体的火花还没际遇迸发,需要一个导火索,这个就可以类比我们程序员,很多比较初中级的程序员主要擅长在原来的代码上修修改改或者给他分配个小功能,比较高级的程序员就需要能做一些项目的架构设计,核心的技术方案设计,以前我也觉得写文档这个比较无聊,但是当一个项目真的比较庞大,复杂的时候,整体和核心部分的架构设计和方案还是需要有文档沉淀的,不然别人不知道没法接受,自己过段时间也会忘记。

-

对于小松的这个建议,他的初衷是想搅一搅这个死气沉沉套路颇深的文坛,因为本身《空气蛹》这部小说的内容很吸引人,小松想通过天吾的润色补充让这部小说冲击新人奖,有种恶作剧的意图,天吾对此表示很多担心和顾虑,小松的这个建议其实也是一种文学作假,有两方面的担心,一方面是原作者深绘里是否同意如此操作,一方面是外界如果发现了这个事实会有什么样的后果,但是小松表示不用担心,前一步由小松牵线,让天吾跟原作者深绘里当面沟通这个代写是否被允许,结果当然是被允许了,这里有了对深绘里的初步描写,按我的理解是比较仙的感觉,然后语言沟通有些吃力,或者说有她自己的特色,当面沟通时貌似是让深绘里回去再考虑下,然后后面再由天吾去深绘里寄宿的戎野老师家沟通具体的细节。

-

2019年12月18日23:37:19 更新
去到戎野老师家之后,天吾知道了关于深绘里的一些事情,深绘里的父亲与戎野老师应该是老友,深绘里的父亲在当初成立了一个叫”先驱”的公社,一个独立运行的社会组织,以运营农场作为物资来源,追求更为松散的共同体,即不过分激进地公有制,进行松散的共同生活,承认私有财产,简而言之就是这样一个能稳定存活下来的独立社会组织,但是随着稳定运行,内部的激进派和稳健派开始出现分歧,不可磨合,后来两派就分裂了,深绘里的父亲,深田保留在了稳健派,但是此时其实深田保内心是矛盾的,以为一开始其实是他倡导的独立革命才组织起了这群人,然而现在他又认清了现实社会已经不太相信能通过革命来独立的可能性,后来激进派便开始越加封闭,而且进行军事训练和思想教育,而后这个先驱的激进派别便有了新的名字”黎明”,深绘里也是在此时从先驱逃离来投靠戎野老师
暂时先写到这,未完待续~

- - -
- - - - - - -
-
-
-
- - - -
@@ -1484,20 +1490,20 @@ @@ -1522,7 +1528,7 @@ diff --git a/lib/pace/README.html b/lib/pace/README.html index 4c7a5b3004..7f211a7c06 100644 --- a/lib/pace/README.html +++ b/lib/pace/README.html @@ -371,20 +371,20 @@ @@ -409,7 +409,7 @@ diff --git a/page/2/index.html b/page/2/index.html index 080f5a9f18..4f7ec9b7c1 100644 --- a/page/2/index.html +++ b/page/2/index.html @@ -223,6 +223,116 @@ +
+ + + + + +
+

+ + +

+ + +
+ + + + +
+ + +

看完了村上春树的《1Q84》,这应该是第五本看的他的书了,继 跑步,挪威的森林,刺杀骑士团长,海边的卡夫卡之后,不是其中最长的,好像是海边的卡夫卡还是刺杀骑士团长比较长一点,都是在微信读书上看的,比较方便,最开始在上面看的是高晓松的《鱼羊野史》,不知道为啥取这个名字,但是还是满吸引我的,不过由于去年的种种,没有很多心思把它看完,而且本身的组织形式就是比较松散的,看到哪算哪,其实一些野史部分是我比较喜欢,有些谈到人物的就不太有兴趣,而且类似于大祥哥吃的东西,反正都是哇,怎么这么好吃,嗯,太爱(niu)你(bi)了,高晓松就是这个人是我最喜欢的 xxx 家,我也没去细究过他有没有说重复过,反正是不太爱,后来因为这书还一度对战争史有了浓厚的兴趣,然而事实告诉我,大部头的战争史,其实正史我是真的啃不下去,我可能只对其中 10%的内容感兴趣,不过终于也在今年把它看完了,好像高晓松的晓说也最终季了,貌似其中讲朝鲜战争的还被和谐了,看样子是说出了一些故事(truth)。

+

本来只是想把 《1Q84》的读后感写下,现在觉得还是把这篇当成我今年的读书总结吧,不过先从《1Q84》说起。

+

严格来讲,这不是很书面化的读后感,可能我想写的也只是像聊天一样的说下我读过的书,包括的技术博客其实也是类似的,以后或许会转变,但是目前水平如此吧,写多了可能会变好,也可能不会。

+

开始正文吧,这书有点类似于海边的卡夫卡,一开始是通过两条故事线,穿插着叙述,一条是青豆的,不算是个职业杀手的女杀手,要去解决一个经常家暴的斯文败类,穿着描述得比较性感吧,杀人方式是通过比较长的细针,从脖子后面一个精巧的位置插入,可以造成是未知原因死亡的假象,可能会推断成心梗之类的,这里有个前置的细节,就是青豆是乘坐一辆很高级的出租车,内饰什么的都非常有质感,有点不像一辆出租车,然后车里放了一首比较小众的歌,雅纳切克的《小交响曲》,但是青豆知道它,这跟后面的情节也有些许关系,这是女主人公青豆的出场;相应的男主的出场印象不是太深刻,男主叫天吾,是个不知名的作家,跟一个叫小松的编辑有比较好的关系,虽然天吾还没有拿到比较有分量的奖项,但是小松很看好他,也让他帮忙审校一个新作家奖的投稿文章,虽然天吾自身还没获得过这个奖,天吾还有个正式工作,是当数学老师,天吾在学生时代是个数学天才,但后面有对文学产生了兴趣,文学还不足以养活自己,靠着教课还是能保持温饱;

+

接下来是正式故事的起点了,就是小松收到了一部小说投稿,名叫《空气蛹》,是个叫深绘里的女孩子投的稿,小松对他赋予了很高的评价,这里好像记岔了,好像是天吾对这部小说很有好感,但是小松比较怀疑,然后小松看了之后也有了浓厚的兴趣,这里就是开端了,小松想让天吾来重写润色这部《空气蛹》,因为故事本身很有分量,但是描写手法叙事方式等都很拙劣,而天吾正好擅长这个,小松对天吾的评价是,描写技巧无可挑剔,就是故事主体的火花还没际遇迸发,需要一个导火索,这个就可以类比我们程序员,很多比较初中级的程序员主要擅长在原来的代码上修修改改或者给他分配个小功能,比较高级的程序员就需要能做一些项目的架构设计,核心的技术方案设计,以前我也觉得写文档这个比较无聊,但是当一个项目真的比较庞大,复杂的时候,整体和核心部分的架构设计和方案还是需要有文档沉淀的,不然别人不知道没法接受,自己过段时间也会忘记。

+

对于小松的这个建议,他的初衷是想搅一搅这个死气沉沉套路颇深的文坛,因为本身《空气蛹》这部小说的内容很吸引人,小松想通过天吾的润色补充让这部小说冲击新人奖,有种恶作剧的意图,天吾对此表示很多担心和顾虑,小松的这个建议其实也是一种文学作假,有两方面的担心,一方面是原作者深绘里是否同意如此操作,一方面是外界如果发现了这个事实会有什么样的后果,但是小松表示不用担心,前一步由小松牵线,让天吾跟原作者深绘里当面沟通这个代写是否被允许,结果当然是被允许了,这里有了对深绘里的初步描写,按我的理解是比较仙的感觉,然后语言沟通有些吃力,或者说有她自己的特色,当面沟通时貌似是让深绘里回去再考虑下,然后后面再由天吾去深绘里寄宿的戎野老师家沟通具体的细节。

+

2019年12月18日23:37:19 更新
去到戎野老师家之后,天吾知道了关于深绘里的一些事情,深绘里的父亲与戎野老师应该是老友,深绘里的父亲在当初成立了一个叫”先驱”的公社,一个独立运行的社会组织,以运营农场作为物资来源,追求更为松散的共同体,即不过分激进地公有制,进行松散的共同生活,承认私有财产,简而言之就是这样一个能稳定存活下来的独立社会组织,但是随着稳定运行,内部的激进派和稳健派开始出现分歧,不可磨合,后来两派就分裂了,深绘里的父亲,深田保留在了稳健派,但是此时其实深田保内心是矛盾的,以为一开始其实是他倡导的独立革命才组织起了这群人,然而现在他又认清了现实社会已经不太相信能通过革命来独立的可能性,后来激进派便开始越加封闭,而且进行军事训练和思想教育,而后这个先驱的激进派别便有了新的名字”黎明”,深绘里也是在此时从先驱逃离来投靠戎野老师
暂时先写到这,未完待续~

+ + +
+ + + + + + +
+
+
+
+ + + + + + +
@@ -1181,101 +1291,6 @@ - - - -
- - - - - -
-

- - -

- - -
- - - - -
- - -

problem

Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn’t one, return 0 instead.

-

For example, given the array [2,3,1,2,4,3] and s = 7,
the subarray [4,3] has the minimal length under the problem constraint.

-

题解

参考,滑动窗口,跟之前Data Structure课上的online算法有点像,链接

-

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class Solution {
public:
int minSubArrayLen(int s, vector<int>& nums) {
int len = nums.size();
if(len == 0) return 0;
int minlen = INT_MAX;
int sum = 0;

int left = 0;
int right = -1;
while(right < len)
{
while(sum < s && right < len)
sum += nums[++right];
if(sum >= s)
{
minlen = minlen < right - left + 1 ? minlen : right - left + 1;
sum -= nums[left++];
}
}
return minlen > len ? 0 : minlen;
}
};
- - -
- - - - - - -
-
-
-
- - - -
@@ -1348,20 +1363,20 @@ @@ -1386,7 +1401,7 @@ diff --git a/page/3/index.html b/page/3/index.html index 247009ad8d..4b7ef15048 100644 --- a/page/3/index.html +++ b/page/3/index.html @@ -223,6 +223,101 @@ +
+ + + + + +
+

+ + +

+ + +
+ + + + +
+ + +

problem

Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn’t one, return 0 instead.

+

For example, given the array [2,3,1,2,4,3] and s = 7,
the subarray [4,3] has the minimal length under the problem constraint.

+

题解

参考,滑动窗口,跟之前Data Structure课上的online算法有点像,链接

+

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class Solution {
public:
int minSubArrayLen(int s, vector<int>& nums) {
int len = nums.size();
if(len == 0) return 0;
int minlen = INT_MAX;
int sum = 0;

int left = 0;
int right = -1;
while(right < len)
{
while(sum < s && right < len)
sum += nums[++right];
if(sum >= s)
{
minlen = minlen < right - left + 1 ? minlen : right - left + 1;
sum -= nums[left++];
}
}
return minlen > len ? 0 : minlen;
}
};
+ + +
+ + + + + + +
+
+
+
+ + + + + + +
@@ -1122,105 +1217,6 @@ - - - -
- - - - - -
-

- - -

- - -
- - - - -
- - -

Number of 1 Bits

Write a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Hamming weight). For example, the 32-bit integer ‘11’ has binary representation 00000000000000000000000000001011, so the function should return 3.

- -
- - Read more » - -
- - - -
- - - - - - -
-
-
-
- - - -
@@ -1293,20 +1289,20 @@ @@ -1331,7 +1327,7 @@ diff --git a/page/4/index.html b/page/4/index.html index 89f64999da..bafe003fe2 100644 --- a/page/4/index.html +++ b/page/4/index.html @@ -223,6 +223,105 @@ +
+ + + + + +
+

+ + +

+ + +
+ + + + +
+ + +

Number of 1 Bits

Write a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Hamming weight). For example, the 32-bit integer ‘11’ has binary representation 00000000000000000000000000001011, so the function should return 3.

+ +
+ + Read more » + +
+ + + +
+ + + + + + +
+
+
+
+ + + + + + +
@@ -879,20 +978,20 @@ @@ -917,7 +1016,7 @@ diff --git a/sitemap.xml b/sitemap.xml index 0934d17385..68871a07f8 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -1,6 +1,13 @@ + + https://nicksxs.me/2020/02/16/Maven%E5%AE%9E%E7%94%A8%E5%B0%8F%E6%8A%80%E5%B7%A7/ + + 2020-02-16T06:31:27.589Z + + + https://nicksxs.me/2020/02/09/G1%E6%94%B6%E9%9B%86%E5%99%A8%E6%A6%82%E8%BF%B0/ @@ -72,14 +79,14 @@ - https://nicksxs.me/2015/01/14/Two-Sum/ + https://nicksxs.me/2019/12/10/Redis-Part-1/ 2020-01-12T13:08:27.015Z - https://nicksxs.me/2019/12/10/Redis-Part-1/ + https://nicksxs.me/2015/01/14/Two-Sum/ 2020-01-12T13:08:27.015Z @@ -121,28 +128,28 @@ - https://nicksxs.me/2016/08/14/docker-mysql-cluster/ + https://nicksxs.me/2014/12/24/MFC%20%E6%A8%A1%E6%80%81%E5%AF%B9%E8%AF%9D%E6%A1%86/ 2020-01-12T13:08:27.011Z - https://nicksxs.me/2014/12/24/MFC%20%E6%A8%A1%E6%80%81%E5%AF%B9%E8%AF%9D%E6%A1%86/ + https://nicksxs.me/2016/08/14/docker-mysql-cluster/ 2020-01-12T13:08:27.011Z - https://nicksxs.me/2019/06/18/openresty/ + https://nicksxs.me/2017/05/09/ambari-summary/ 2020-01-12T13:08:27.010Z - https://nicksxs.me/2017/05/09/ambari-summary/ + https://nicksxs.me/2019/06/18/openresty/ 2020-01-12T13:08:27.010Z @@ -184,14 +191,14 @@ - https://nicksxs.me/2017/03/28/spark-little-tips/ + https://nicksxs.me/2014/12/23/my-new-post/ 2020-01-12T13:08:26.998Z - https://nicksxs.me/2014/12/23/my-new-post/ + https://nicksxs.me/2017/03/28/spark-little-tips/ 2020-01-12T13:08:26.998Z @@ -226,14 +233,14 @@ - https://nicksxs.me/2017/04/25/rabbitmq-tips/ + https://nicksxs.me/2015/01/04/Path-Sum/ 2020-01-12T13:08:26.993Z - https://nicksxs.me/2015/01/04/Path-Sum/ + https://nicksxs.me/2017/04/25/rabbitmq-tips/ 2020-01-12T13:08:26.993Z @@ -247,14 +254,14 @@ - https://nicksxs.me/2019/09/23/AbstractQueuedSynchronizer/ + https://nicksxs.me/2015/04/15/Leetcode-No-3/ 2020-01-12T13:08:26.991Z - https://nicksxs.me/2015/04/15/Leetcode-No-3/ + https://nicksxs.me/2019/09/23/AbstractQueuedSynchronizer/ 2020-01-12T13:08:26.991Z diff --git a/tags/2019/index.html b/tags/2019/index.html index 21015e2af9..bd4bd491ac 100644 --- a/tags/2019/index.html +++ b/tags/2019/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/Design-Patterns/index.html b/tags/Design-Patterns/index.html index 8220ae3b38..fa1edb2e1d 100644 --- a/tags/Design-Patterns/index.html +++ b/tags/Design-Patterns/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/Distributed-Lock/index.html b/tags/Distributed-Lock/index.html index ce8ab59aa4..83be6d48dc 100644 --- a/tags/Distributed-Lock/index.html +++ b/tags/Distributed-Lock/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/G1/index.html b/tags/G1/index.html index e286339d3e..20279eea5c 100644 --- a/tags/G1/index.html +++ b/tags/G1/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/GC/index.html b/tags/GC/index.html index 1f30f703b2..6c66486718 100644 --- a/tags/GC/index.html +++ b/tags/GC/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/Garbage-First-Collector/index.html b/tags/Garbage-First-Collector/index.html index c6e54a2839..70e1c1d5f8 100644 --- a/tags/Garbage-First-Collector/index.html +++ b/tags/Garbage-First-Collector/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/JVM/index.html b/tags/JVM/index.html index 260a6ab85c..bb2056b5dd 100644 --- a/tags/JVM/index.html +++ b/tags/JVM/index.html @@ -351,20 +351,20 @@ @@ -389,7 +389,7 @@ diff --git a/tags/Maven/index.html b/tags/Maven/index.html new file mode 100644 index 0000000000..820a468262 --- /dev/null +++ b/tags/Maven/index.html @@ -0,0 +1,512 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Tag: Maven | Nicksxs's Blog + + + + + + + + + + + + + + + + +
+
+ +
+
+
+ + +

What hurts more, the pain of hard work or the pain of regret?

+
+ + +
+ + + +
+
+ + +
+ + 0% +
+ + + + +
+
+
+ + +
+ + + + + +
+
+
+

Maven + Tag +

+
+ + +
+

2020

+
+ + + +
+
+ + + + + + + + +
+ + + + +
+ + + + + + + + +
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/Redis/index.html b/tags/Redis/index.html index 7e7c50c0d0..4f63e2b9a2 100644 --- a/tags/Redis/index.html +++ b/tags/Redis/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ @@ -510,3 +510,133 @@ +com/" title="http://www.zipperary.com/" rel="noopener" target="_blank">Zippera's blog + + + + + + + +
+ +
+ +
+ + + + +
+ + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/Singleton/index.html b/tags/Singleton/index.html index a9da283c75..961756441c 100644 --- a/tags/Singleton/index.html +++ b/tags/Singleton/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/aqs/index.html b/tags/aqs/index.html index fcfd2baeb8..20f69c5f37 100644 --- a/tags/aqs/index.html +++ b/tags/aqs/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/c/index.html b/tags/c/index.html index 326d254157..d3784daec8 100644 --- a/tags/c/index.html +++ b/tags/c/index.html @@ -55,7 +55,7 @@ - + @@ -66,7 +66,7 @@ - + - Tag: c++ | Nicksxs's Blog + Tag: C | Nicksxs's Blog + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + class="tag-list-link" href="/tags/websocket/" rel="tag">websocket1
  • 1
  • 1
  • 1
  • 1
  • 6
  • 6
  • 1
  • 1
  • 1
  • diff --git a/tags/c/page/2/index.html b/tags/c/page/2/index.html index 9921580a10..986c69e7ff 100644 --- a/tags/c/page/2/index.html +++ b/tags/c/page/2/index.html @@ -394,20 +394,20 @@ @@ -432,7 +432,7 @@ diff --git a/tags/cluster/index.html b/tags/cluster/index.html index c8a67f70c3..69358c8dcc 100644 --- a/tags/cluster/index.html +++ b/tags/cluster/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/docker/index.html b/tags/docker/index.html index 030e3ef158..0bdfe8d092 100644 --- a/tags/docker/index.html +++ b/tags/docker/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/hadoop/index.html b/tags/hadoop/index.html index d1723a32ec..97bd1992d0 100644 --- a/tags/hadoop/index.html +++ b/tags/hadoop/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/im/index.html b/tags/im/index.html index 236fbc8105..de3b96cc38 100644 --- a/tags/im/index.html +++ b/tags/im/index.html @@ -328,20 +328,20 @@ @@ -366,7 +366,7 @@ diff --git a/tags/index.html b/tags/index.html index 5ccca0b1d1..778fa5c815 100644 --- a/tags/index.html +++ b/tags/index.html @@ -247,10 +247,10 @@
    @@ -337,20 +337,20 @@ @@ -375,7 +375,7 @@ diff --git a/tags/java/index.html b/tags/java/index.html index aca4163b76..ee02949218 100644 --- a/tags/java/index.html +++ b/tags/java/index.html @@ -55,7 +55,7 @@ - + @@ -66,7 +66,7 @@ - + - Tag: Java | Nicksxs's Blog + Tag: java | Nicksxs's Blog + + + + + + +="/js/motion.js"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +