Creating a custom generator failing on mvn package on Windows 10 Powershell

51 views
Skip to first unread message

Jereme Evans

unread,
Apr 13, 2017, 6:45:14 PM4/13/17
to Swagger
I am attempting to create a custom generator. I am able to build swagger-codegen no problem and generate a custom generator using:

java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar meta -o output/myLibrary -n myLibrary

I made some changes that I believe should make a generator that works, but when I try and run mvn package, I end up with the following error:

Could not find the artifact io.swagger:swagger-codegen:jar.2.2.3-SNAPSHOT

I'm pretty unfamiliar with maven, so I'm pretty sure there is something simple I'm missing. What should I try?

tony tam

unread,
Apr 13, 2017, 7:00:16 PM4/13/17
to swagger-sw...@googlegroups.com
That’s in your generator itself?  Try changing the swagger-codegen version from 2.2.3-SNAPSHOT to 2.2.3 and rebuild

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jereme Evans

unread,
Apr 14, 2017, 1:35:20 PM4/14/17
to Swagger
I managed to get it to build by installing ... ?? ... the swagger code gen build. From the swagger codegen repository, I ran:

mvn install

That seemed to add it so maven knew how to find it, and I was able to build. Now I'm running into issues with -cp and including multiple jar files. When I run this:

java -cp /git/swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar io.swagger.codegen.Codegen -l typescript-angular2 -i http://api.aq.dev:80/swagger/docs/v4 -o c:\temp\AQ4-TypeScript -c C:\git\AQ4\AQConfig.json

I can successfully build the client. When I run this:

java -cp /temp/typescript-aurelia-fetch-client/target/typescript-aurelia-fetch-client-swagger-codegen-1.0.0.jar;/git/swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar io.swagger.codegen.Codegen -l typescript-aurelia-fetch-client -i http://api.aq.dev:80/swagger/docs/v4 -o c:\temp\AQ4-TypeScript -c C:\git\AQ4\AQConfig.json

I end up with the following error:

/git/swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar : The term
'/git/swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:113
+ ... n-1.0.0.jar;/git/swagger-codegen/modules/swagger-codegen-cli/target/s ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (/git/swagger-co...codegen-cli.jar:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

Jereme Evans

unread,
Apr 14, 2017, 3:53:55 PM4/14/17
to Swagger
I figured this out. It turns out that in Windows PowerShell, you have to wrap your list of jar files in '' ... so this worked:

java -cp '/temp/typescript-aurelia-fetch-client/target/typescript-aurelia-fetch-client-swagger-codegen-1.0.0.jar;./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar' io.swagger.codegen.Codegen -i http://api.aq.dev:80/swagger/docs/v4 -l typescript-aurelia-fetch-client -o c:\temp\AQ4-TypeScript -c C:\git\AQ4\AQConfig.json
Reply all
Reply to author
Forward
0 new messages