Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Request | make: swagger-codegen: Command not found #468

Closed
taugenichts opened this issue Oct 4, 2017 · 1 comment
Closed

Support Request | make: swagger-codegen: Command not found #468

taugenichts opened this issue Oct 4, 2017 · 1 comment

Comments

@taugenichts
Copy link

Hello,
I tried to run make test, but it failed.

make test
protoc -I /usr/local/bin//../include -I. -Ithird_party/googleapis --plugin=bin/protoc-gen-swagger --swagger_out=logtostderr=true,Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor,Mexamples/sub/message.proto=github.com/grpc-ecosystem/grpc-gateway/examples/sub:. examples/examplepb/echo_service.proto examples/examplepb/a_bit_of_everything.proto
protoc -I /usr/local/bin//../include -I. -Ithird_party/googleapis --plugin=bin/protoc-gen-swagger --swagger_out=logtostderr=true,Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor,Mexamples/sub/message.proto=github.com/grpc-ecosystem/grpc-gateway/examples/sub:. examples/examplepb/echo_service.proto examples/examplepb/a_bit_of_everything.proto
swagger-codegen generate -i examples/examplepb/echo_service.swagger.json
-l go -o examples/clients/echo --additional-properties packageName=echo
make: swagger-codegen: Command not found
Makefile:111: recipe for target 'examples/clients/echo/echo_service_api.go' failed

I made sure, that swagger-codegen is buildable. Also i used the release from 2.1.6

[INFO] Reactor Summary:
[INFO]
[INFO] swagger-codegen-project ............................ SUCCESS [ 4.842 s]
[INFO] swagger-codegen (core library) ..................... SUCCESS [ 43.337 s]
[INFO] swagger-codegen (executable) ....................... SUCCESS [ 7.355 s]
[INFO] swagger-codegen (maven-plugin) ..................... SUCCESS [ 5.588 s]
[INFO] swagger-generator .................................. SUCCESS [ 18.557 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:20 min
[INFO] Finished at: 2017-10-04T05:34:19-04:00
[INFO] Final Memory: 58M/241M
[INFO] ------------------------------------------------------------------------

I found out that the syntax 'swagger-codegen generate' in the Makefile is the command used for Homebrew. So I installed Linuxbrew - but the problem is, I cannot run the command swagger-codegen as root user.

How can I solve this?
Thank you!

@ivucica
Copy link
Collaborator

ivucica commented Dec 7, 2017

See .travis.yml to see how tests are being set up. It will point you to .travis/install-swagger-codegen.sh which, if you examine it, fetches a version of swagger-codegen into ~/local/swagger-codegen-cli.jar

If you read further, at this point if you want to run tests, you pass it the correct command to invoke swagger-codegen as a make variable:

 make whatever-target-you-actually-want SWAGGER_CODEGEN="java -jar $HOME/local/swagger-codegen-cli.jar"

You don't need Linuxbrew, nor if you did can I see where running swagger-codegen as root would come into play.

You shouldn't make or make test things as root, ever. You should at most make install software that support installation, but after running make as a regular user.

@achew22 achew22 closed this as completed Dec 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants