我在一个项目中使用 swagger-codegen ,最后我问自己一个问题:swagger 文件的位置是否有任何约定?
这是我的情况:
我在我的项目中使用 Maven,所以我有标准的 Maven 结构:
pom.xml
src
|--main
|--java
|--resources
|--webapp
|--test
|--java
|--resources
Run Code Online (Sandbox Code Playgroud)
为了使用 Swagger 生成我的 REST API,我必须将 swagger.json、一些 mustache 模板和 .swagger-codegen-ignore 放在某处。我已经把它们(自然地?)放在 src/main/resources 中:
resources
|--api
|--v2
|--swagger.json
|--swaggerconfig
|--api.mustache
|--[...]
|--.swagger-codegen-ignore
Run Code Online (Sandbox Code Playgroud)
我已经使用适当的 swagger-codegen-maven-plugin 配置了我的 pom.xml 并将打包设置为 war,以便生成我的战争(以便将其部署在 Tomcat 中)。摘录:
[...]
<packaging>war</packaging>
[...]
<build>
<finalName>my-project</finalName>
<plugins>
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${basedir}/src/main/resources/api/v2/swagger.json</inputSpec>
<language>jaxrs</language>
<templateDirectory>${basedir}/src/main/resources/swaggerconfig</templateDirectory>
<addCompileSourceRoot>true</addCompileSourceRoot>
<configOptions>
<library>jersey2</library>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
<!-- .swagger-codegen-ignore must be located at …Run Code Online (Sandbox Code Playgroud) 所以,我正在尝试将一个工具从 Java 8 迁移到 Java 11。
我做了第一步,让它在没有模块的情况下工作并且代码成功编译。
现在我正在尝试添加 module-info.java,但由于我的工具中使用的库,我首先遇到了问题。有些已经与 Java 11(例如 Lombok)兼容,但有些则不兼容,因此我尝试使用requires和 artifactId 名称导入它们。
但是由于我的 Maven 模型和 Maven 模型构建器依赖性,我似乎卡住了,因为我在构建时遇到以下错误:
[ERROR] the unnamed module reads package org.apache.maven.model.merge from both maven.model.builder and maven.model
[ERROR] module maven.model.builder reads package org.apache.maven.model.merge from both maven.model.builder and maven.model
[ERROR] module maven.model reads package org.apache.maven.model.merge from both maven.model.builder and maven.model
Run Code Online (Sandbox Code Playgroud)
对于这种错误,我该怎么办?似乎我需要两者(如果我评论一个或另一个,构建仍然失败)。这是否意味着我无法将模块添加到我的工具中?
注意:库设置为最新版本(即 3.6.3)
我正在使用JavaFX + FXML构建一个小应用程序,我正在尝试实现一些简单的CSS以具有特定的样式.
我有一个Combobox元素的问题.确实,默认情况下它的颜色为灰色:
我希望它具有白色(或透明),并保持边框,以匹配与文本字段相同的样式.所以我尝试将背景颜色设置为透明但有副作用:边框也变得透明!
这是我添加的CSS:
.root {
-fx-font-size: 11pt;
-fx-font-family: "Verdana";
-fx-background: #FFFFFF;
}
.normal-label {
-fx-text-fill: #005EB8;
}
.normal-text-field {
-fx-text-fill: #333333;
}
.combo-box {
-fx-background-color: transparent;
}
Run Code Online (Sandbox Code Playgroud)
我根本不习惯CSS写作,所以也许我完全错过了一些东西.是不是组合框没有定义边界?所以我必须覆盖边框并找出文本字段的边框是什么?