这里说明一下:
使用得jasypt-spring-boot得版本是1.18
因为我们项目没有用springboot 2.0
拉取得是tag里面得一个分支。
项目加解密的key 盐值
用到的key 是
jasypt.encryptor.password = yourkey
这个boot里面properties的jasypt.encryptor.password属性值,要配置到,两个选择
1 全局的配置中心 比如apollo的glabal common里面
2 或者每个项目组的各个项目里面都要单独配置一下)
很多人可以看到 这样就对保密性,不太好,
大家搜一下百度都知道 是盐,算法找下就可以反过来解密,
本文的目的就是给jasypt.encryptor.password 换个名字 比如看着不像是记录密钥的
举个例子
com.xxcompany.framework.info=xxcompany
xxcompany 其实就是盐 但是这样即使看着也隐蔽性很高
项目拉下来改好之后 ( 已经传github)
https://github.com/albertflyer/jasypt-spring-boot-jasypt-spring-boot-parent-1.18
涉及改动的地方 和官方1.18的版本比较
以下是deploy公司私服遇到的一些问题。
1 首先提示一个deploy错误是
nexus-staging-maven-plugin:1.6.8:deploy failed: Server credentials with ID "ossrh" not found!
查了google发现大致是xml里面
deploy得地址是官方得
如下:
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
本来我们工程私服地址是配置在setting.xml里面管理得 这个既然放置在pom.xml
我们也把私服地址修改下
<distributionManagement>
<repository>
<id>releases</id>
<url>http://192.168.1.184:8081/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>http://192.168.1.184:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
然后把源码里面涉及到ossrh得地方都拿掉.
上述过程种还可能遇到
Deployment failed: repository element was not specified in the POM inside distributionManagement ...
错误 参考 https://blog.csdn.net/weixin_34392435/article/details/87503329 上面其实也给出了解决方法
2 注意
在maven的settings.xml文件中做如下配置:
-
<server>
-
<id>nexus-releases</id>
-
<username>admin</username>
-
<password>admin123</password>
-
</server>
-
<server>
-
<id>nexus-snapshots</id>
-
<username>admin</username>
-
<password>admin123</password>
-
</server>
注意这里配置的server的id必须和pom文件中的distributionManagement对应仓库的id保持一致,maven在处理发布时会根据id查找用户名称和密码进行登录和文件的上传发布。不然会报401授权错误。
然后再次deploy 就可以了