MAC上配置idea环境时排查问题


现象:没有使用走公司maven仓库的setting.xml文件时,只有公司内部依赖 没有找到
在idea的maven配置中指定 公司setting.xml后,所有的文件都提示找不到

 

解决办法:
把公司settging.xml中在windwos上本地仓库路径删除即可:

原因:
setting.xml中配置的路径 是 D:\maven\repository  这个路径在mac上是没有的。所以相当于所有依赖都缺失

 

反思:对比法排查问题,从差异中找到线索

远离: 坐  等   要  靠

mac中环境变变量配置不生效的问题:
(1)cd
(2)vi .bash_profile
(3)增加一行 :

alias ll='ls -l'

(4)source .bash_profile
(5)关闭terminal,再打开。执行命令 ll 时,提示:
zsh:command not found 
解决办法:
(1)cd
(2)vi .zshrc
(3)增加一行:source .bash_profile
(4)source .zshrc
关闭terminal窗口,再打开就可以了
原因:.bash_profile是bash使用的配置文件。mac中默认使用了zsh

Springboot项目在Macos上启动很慢,没有找到原因,

Executing pre-compile tasks...
Too many modules require recompilation, forcing full project rebuild
Cleaning output directories...
Running 'before' tasks
Checking sources
Copying resources... [mq]
Parsing java... [mq]
Writing classes... [mq]
Updating dependency information... [mq]
Adding @NotNull assertions... [mq]
Adding pattern assertions... [mq]
Parsing java... [tests of mq]
Writing classes... [tests of mq]
Updating dependency information... [tests of mq]
Adding @NotNull assertions... [tests of mq]
Adding pattern assertions... [tests of mq]
Running 'after' tasks
javac 1.8.0_261 was used to compile java sources
Finished, saving caches...
Executing post-compile tasks...
Synchronizing output directories...
2020/10/16, 1:27 下午 - Build completed successfully in 7 m 45 s

无意中发现有这个打印:

2020-10-16 12:05:22.275  WARN 42220 --- [main] o.s.boot.StartupInfoLogger: InetAddress.getLocalHost().getHostName() took 5024 milliseconds to respond. Please verify your network configuration (macOS machines may need to add entries to /etc/hosts).

查看现在的/etc/hosts文件中的内容:

tangcheng@tangchengdeMacBook-Pro ~ % cat /etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1    localhost
255.255.255.255    broadcasthost
::1             localhost

原因及解决办法:

因为本机的hostname没有写入到hosts中,需要手动进行添加,输入命令行输入hostname得到hostname,在etc/hosts中添加解析记录到127.0.0.1与::1的记录,添加完成后项目就会启动飞快。

更改到本机的主机名:

保存时

 

 


 

 

 

 

 

输入O
再输入 :wq 退出 

问题解决
重新启动项目后的日志打印中会有主机名:

2020-10-16 15:25:48.620  INFO 1267 --- [main] com.tangcheng.mq.MqApplication : Starting MqApplication on tangchengdeMacBook-Pro.local with PID 1267 (/Users/tangcheng/workspace/mq/target/classes started by tangcheng in /Users/tangcheng/workspace/mq)

 




 

posted @ 2019-07-26 13:52  沧海一滴  阅读(1845)  评论(0编辑  收藏  举报