我有一个关于Jenkins 管道readMavenPom
(链接到文档)实用程序的问题。
我有一个项目,pom.xml
其中groupId
定义了no ,但它pom.xml
有一个定义了 aa 的父 pom groupId
。(可能会发生这种情况,即使这个父级也没有定义,groupId
并且 parent.parent 是拥有它的那个)。
有没有办法以优雅的方式让我们说有效 groupId
?
我目前正在null
使用 getGroupId() 方法(或属性访问器.groupId
)
注意:以优雅的方式我的意思是,不要循环到父母并检查 groupId 是否不为空。
提前致谢。
我需要阅读,修改和重新生成JSON/YAML swagger文件文档.我用Swagger Parser反序列化了一个JSON文件,我有一个Swagger Java对象,原始的JSON数据映射正确.
现在,我需要修改Swagger Java对象,并生成带有完成修改的JSON或YAML文件.
有没有办法做到这一点?
摘要:
File fileJSON = FileUtils.toFile(getClass().getResource("example-api-rest.json"));
Swagger swagger = new SwaggerParser().read(fileJSON.getPath()); //Got it!
...
swagger.editWhatever
...
//Here I need to generate the JSON or YAML again
Run Code Online (Sandbox Code Playgroud)
谢谢.
我有一个关于DateTimeFormatter
格式化程序的问题。
在 SWAPI ( https://swapi.co/documentation#people ) 中,您可以阅读日期created
和edited
日期,格式如下:
2014-12-09T13:50:51.644000Z
Run Code Online (Sandbox Code Playgroud)
但在该文档类DateTimeFormatter在预定义的格式化程序部分,我不能看到SWAPI日期例子匹配任何格式。
问题是,当我尝试解析它时,正在使用SSSSSS:
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'")
Run Code Online (Sandbox Code Playgroud)
与nnnnnn:
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.nnnnnn'Z'")
Run Code Online (Sandbox Code Playgroud)
知道哪一个是正确的格式化程序吗?