I麓m trying to create a custom codegen, I managed to make it work by putting the files inside of the codegen project but I want it to work like this.
I haven麓t modified the autogenerated project at all but I keep getting:
Error: Could not find or load main class io.swagger.codegen.SwaggerCodegen
2.1.6
java -cp output/myLibrary/target/myCustomCodegen-swagger-codegen-1.0.0.jar:swagger-codegen-cli-2.1.6.jar io.swagger.codegen.SwaggerCodegen generate -i https://watson-api-explorer.mybluemix.net/listings/conversation-v1-experimental.json -l com.my.company.codegen.Mycustomcodegengenerator -o outputlocation
I got the jar from here
java -jar swagger-codegen-cli-2.1.6.jar meta \
-o output/myLibrary -n myClientCodegen -p com.my.company.codegen
to create costume codegenmvn package in output/myLibraryjava -cp output/myLibrary/target/myCustomCodegen-swagger-codegen-1.0.0.jar:swagger-codegen-cli-2.1.6.jar io.swagger.codegen.SwaggerCodegen generate -i https://watson-api-explorer.mybluemix.net/listings/conversation-v1-experimental.json -l com.my.company.codegen.Mycustomcodegengenerator -o outputlocation in the folder that contains both swagger-codege-cli-2.1.6.jar and the output folderI am also experiencing this with 2.2.2-SNAPSHOT.
Same here with 2.2.2-SNAPSHOT.
Any solutions yet?
I found the problem: If you are on Windows use a semi-colon instead of a colon in your classpath like so:
java -cp "yourLib/target/yourLib-swagger-codegen-1.0.0.jar;modules/swagger-codegen-cli/target/swagger-codegen-cli.jar" io.swagger.codegen.SwaggerCodegen
Can you verify whether that works for you?
@fischerman It didn't worked for me, I keep getting the same error with the semi-colon
I tried it with 2.2.1, the last stable release
I tried with @fischerman solution once again and it worked, the semi-colon and quotation marks fixed it.
Thanks!
Thanks @fischerman for the tips and @lsarni for verifying.
I've updated the README accordingly: https://github.com/swagger-api/swagger-codegen/blob/master/README.md#making-your-own-codegen-modules
Most helpful comment
I found the problem: If you are on Windows use a semi-colon instead of a colon in your classpath like so:
Can you verify whether that works for you?