Why is swagger-codegen generating project with missing dependencies?
Running:
java -jar swagger-codegen-cli.jar generate -l java -i swagger.json
Generates a project with this for example:
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2021-04-27T18:37:06.211+08:00")
public class Table {
@SerializedName("requiredIndexColumns")
private List<Column> requiredIndexColumns = null;
Where javax.annotation.Generate
cannot be resolved.
And then compiling the generated project throws: Error:(33,18) java: package javax.annotation does not exist
Here's how to test this (using a public swagger):
wget https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.19/swagger-codegen-cli-2.4.19.jar -O swagger-codegen-cli.jar
Then run:
java -jar swagger-codegen-cli.jar generate -l java -i https://petstore.swagger.io/v2/swagger.json -o petstore