swagger-codegen安装在mac上

时间:2013-10-30 20:54:56

标签: scala restler swagger

我正在拼命想要使用OS X Mountain Lion在我的Macbook Pro上使用swagger-codegen。

将Java升级到1.7。

java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

已安装Homebrew。

每个“酿造医生”卸载Mono和Xamarin。

每个“brew doctor”安装Xcode命令行工具。

执行“brew update”

已安装的scala“brew install scala”。

已安装sbt“brew install sbt”

执行“sbt”

[info] Loading project definition from /Users/jecz/Apache/swagger-codegen-master/project
[info] Set current project to swagger-codegen (in build file:/Users/jecz/Apache/swagger-codegen-master/)

执行“./sbt assembly”

Detected sbt version 0.13.0
[info] Loading project definition from /Users/jecz/Apache/swagger-codegen-master/project
[info] Set current project to swagger-codegen (in build file:/Users/jecz/Apache/swagger-codegen-master/)
[warn] Credentials file /Users/jecz/.ivy2/.credentials does not exist
[info] ResourceExtractorTest:
[info] ResourceExtractor
[info] - should get 3 apis from a resource listing
[info] ApiExtractorTest:
[info] ApiExtractor
[info] - should verify the deserialization of the store api
[info] ResourceListingValidationTest:
[info] - should not have base path
[info] - should fail resource listing without apiVersion
[info] - should fail with missing paths in a ResourceListing
[info] ApiListingReferenceValidationTest:
[info] - should deserialize an ApiListingReference
[info] - should serialize an ApiListingReference
[info] ApiDescriptionValidationTest:
[info] - should fail to deserialize an ApiDescription with path, method, return type
[info] OperationValidationTest:
[info] - should fail to deserialize an Operation with missing param type
[info] - should serialize an operation
[info] ResponseMessageValidationTest:
[info] - should deserialize an ResponseMessage
[info] - should serialize an operation
[info] ParameterValidationTest:
[info] - should deserialize another param
[info] - should deserialize a parameter
[info] - should serialize a parameter
[info] ModelValidationTest:
[info] - should deserialize a model
[info] - should serialize a model
[info] ModelRefValidationTest:
[info] - should deserialize a model ref
[info] - should serialize a model ref
[info] ModelPropertyValidationTest:
[info] - should deserialize a model property with allowable values and ref
[info] - should serialize a model property with allowable values and ref
[info] - should deserialize a model property with allowable values
[info] - should serialize a model property with allowable values
[info] - should deserialize a model property
[info] - should serialize a model property
[info] AllowableValuesValidationTest:
[info] - should deserialize allowable value list
[info] - should serialize allowable values list
[info] - should deserialize allowable values range
[info] - should serialize allowable values range
[info] ResourceListingSerializersTest:
[info] - should deserialize an ResourceListing with no apis
[info] - should serialize an ApiListingReference with no apis
[info] - should deserialize an ResourceListing
[info] - should serialize an ApiListingReference
[info] ApiListingReferenceSerializersTest:
[info] - should deserialize an ApiListingReference
[info] - should serialize an ApiListingReference
[info] ApiDescriptionSerializersTest:
[info] - should deserialize an ApiDescription with no ops
[info] - should serialize an ApiDescription with no operations
[info] - should deserialize an ApiDescription
[info] - should serialize an ApiDescription
[info] OperationSerializersTest:
[info] - should deserialize an Operation
[info] - should serialize an operation
[info] ErrorResponseSerializersTest:
[info] - should deserialize an ResponseResponse
[info] - should serialize an operation
[info] ParameterSerializersTest:
[info] - should deserialize another param
[info] - should deserialize a parameter
[info] - should serialize a parameter
[info] ModelSerializationTest:
[info] - should deserialize a model
[info] - should serialize a model
[info] ModelRefSerializationTest:
[info] - should deserialize a model ref
[info] - should serialize a model ref
[info] ModelPropertySerializationTest:
[info] - should deserialize a model property with allowable values and ref
[info] - should serialize a model property with allowable values and ref
[info] - should deserialize a model property with allowable values
[info] - should serialize a model property with allowable values
[info] - should deserialize a model property
[info] - should serialize a model property
[info] AllowableValuesSerializersTest:
[info] - should deserialize allowable value list
[info] - should serialize allowable values list
[info] - should deserialize allowable values range
[info] - should serialize allowable values range
[info] ResourceListingValidationTest:
[info] - should fail resource listing without base path
[info] - should fail resource listing without apiVersion
[info] - should fail with missing paths in a ResourceListing
[info] ApiListingReferenceValidationTest:
[info] - should deserialize an ApiListingReference
[info] - should serialize an ApiListingReference
[info] ApiDescriptionValidationTest:
[info] - should fail to deserialize an ApiDescription with path, method, return type
[info] OperationValidationTest:
[info] - should fail to deserialize an Operation with missing param type
[info] - should serialize an operation
[info] ResponseMessageValidationTest:
[info] - should deserialize an ResponseMessage
[info] - should serialize an operation
[info] ParameterValidationTest:
[info] - should deserialize another param
[info] - should deserialize a parameter
[info] - should serialize a parameter
[info] ModelValidationTest:
[info] - should deserialize a model
[info] - should serialize a model
[info] ModelRefValidationTest:
[info] - should deserialize a model ref
[info] - should serialize a model ref
[info] ModelPropertyValidationTest:
[info] - should deserialize a model property with allowable values and ref
[info] - should serialize a model property with allowable values and ref
[info] - should deserialize a model property with allowable values
[info] - should serialize a model property with allowable values
[info] - should deserialize a model property
[info] - should serialize a model property
[info] AllowableValuesValidationTest:
[info] - should deserialize allowable value list
[info] - should serialize allowable values list
[info] - should deserialize allowable values range
[info] - should serialize allowable values range
[info] SwaggerModelTest:
[info] Swagger Model
[info] - should deserialize ResourceListing
[info] - should deserialize ApiListing
[info] - should deserialize ApiListing with AllowableValues
[info] - should maintain model property order when deserializing
[info] - should deserialize models
[info] ResourceExtractorTest:
[info] ResourceExtractor
[info] - should get 3 apis from a resource listing
[info] ApiExtractorTest:
[info] ApiExtractor
[info] - should verify the deserialization of the store api
09:49:13,840 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
09:49:13,840 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
09:49:13,840 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/Users/jecz/Apache/swagger-codegen-master/target/scala-2.9.1/classes/logback.xml]
09:49:13,991 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
09:49:14,000 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
09:49:14,012 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
09:49:14,114 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - This appender no longer admits a layout as a sub-component, set an encoder instead.
09:49:14,114 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - To ensure compatibility, wrapping your layout in LayoutWrappingEncoder.
09:49:14,114 |-WARN in ch.qos.logback.core.ConsoleAppender[STDOUT] - See also http://logback.qos.ch/codes.html#layoutInsteadOfEncoder for details
09:49:14,116 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.wordnik] to DEBUG
09:49:14,116 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to ERROR
09:49:14,116 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
09:49:14,117 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
09:49:14,119 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@7b1b9e3a - Registering current configuration as safe fallback point

[info] BasicScalaGeneratorTest:
[info] BasicScalaGenerator
[info] - should process a response declaration
[info] - should process a string response
[info] - should process a string array
[info] - should process an unmapped response type
[info] - should get the invoker package
[info] - should get the api package
[info] - should get the model package
[info] - should convert to a declared type
[info] - should convert a string a declaration
[info] - should honor the import mapping
[info] - should quote a reserved var name
[info] - should create a declaration with a List of strings
[info] - should create a declaration with a List of ints
[info] - should create a declaration with a List of floats
[info] - should create a declaration with a List of doubles
[info] - should create a declaration with a List of complex objects
[info] - should verify an api map with query params
[info] - should verify an api map with query params with default values
[info] - should create an api file
[info] BasicGeneratorTest:
[info] BasicGenerator
[info] - should get operations
[info] - should verify ops are grouped by path correctly
[info] - should create a model map
[info] - should create a model file
[info] BasicJavaGeneratorTest:
[info] BasicJavaGenerator
[info] - should process a response declaration
[info] - should process a string response
[info] - should process a string array
[info] - should process an upper-case string array
[info] - should process an unmapped response type
[info] - should get the invoker package
[info] - should get the api package
[info] - should get the model package
[info] - should convert to a declared type
[info] - should convert a string a declaration
[info] - should honor the import mapping
[info] - should quote a reserved var name
[info] - should create a declaration with a List of strings
[info] - should create a declaration with a List of ints
[info] - should create a declaration with a List of floats
[info] - should create a declaration with a List of doubles
[info] - should create a declaration with a List of complex objects
[info] CodegenConfigTest:
[info] PathUtil
[info] - should convert an api name
[info] - should convert a path
[info] CodegenConfig
[info] - should process a response declaration
[info] - should process an unchanged response
[info] - should process an mapped response type
[info] - should get the invoker package
[info] - should get the api package
[info] - should get the model package
[info] - should convert to a declared type
[info] - should honor the import mapping
[info] - should quote a reserved var name
[info] CoreUtilsTest:
[info] CoreUtils
[info] - should verify models are extracted
[info] - should verify operation names
[info] - should find required models
[info] - should find required models from a nested list
[info] PathUtilTest:
[info] PathUtil
[info] - should convert an api name
[info] - should convert a path
[info] - should get determine the basePath implicitly
[info] ResourceListingSerializersTest:
[info] - should deserialize an ResourceListing with no apis
[info] - should serialize an ApiListingReference with no apis
[info] - should deserialize an ResourceListing
[info] - should serialize an ApiListingReference
[info] ApiListingReferenceSerializersTest:
[info] - should deserialize an ApiListingReference
[info] - should serialize an ApiListingReference
[info] ApiDescriptionSerializersTest:
[info] - should deserialize an ApiDescription with no ops
[info] - should serialize an ApiDescription with no operations
[info] - should deserialize an ApiDescription
[info] - should serialize an ApiDescription
[info] OperationSerializersTest:
[info] - should deserialize an Operation
[info] - should deserialize an Operation with an array property
[info] - should serialize an operation
[info] - should deserialize an Operation with array
[info] ErrorResponseSerializersTest:
[info] - should deserialize an Response
[info] - should serialize an operation
[info] ParameterSerializersTest:
[info] - should deserialize another param
[info] - should deserialize a parameter
[info] - should serialize a parameter
[info] ModelSerializationTest:
[info] - should deserialize a model
[info] - should deserialize a model with a set
[info] - should serialize a model
[info] ModelRefSerializationTest:
[info] - should deserialize a model ref
[info] - should serialize a model ref
[info] ModelPropertySerializationTest:
[info] - should deserialize a model property with allowable values and ref
[info] - should serialize a model property with allowable values and ref
[info] - should deserialize a model property with allowable values
[info] - should serialize a model property with allowable values
[info] - should deserialize a model property
[info] - should serialize a model property
[info] - should extract model properties
[info] - should extract model properties with arrays
[info] AllowableValuesSerializersTest:
[info] - should deserialize allowable value list
[info] - should serialize allowable values list
[info] - should deserialize allowable values range
[info] - should serialize allowable values range
[info] CoreUtilsTest:
[info] CoreUtils
[info] - should verify models are extracted
[info] - should verify operation names
[info] - should find required models
[info] - should find required models from a nested list
[info] BasicCSharpGeneratorTest:
[info] BasicCSharpGenerator
[info] - should perserve the name date
[info] - should process a string array
[info] Passed: Total 194, Failed 0, Errors 0, Passed 194
[info] Including from cache: json4s-ast_2.9.1-3.2.5.jar
[info] Including from cache: jackson-annotations-2.2.2.jar
[info] Including from cache: jackson-core-2.2.2.jar
[info] Including from cache: json4s-core_2.9.1-3.2.5.jar
[info] Including from cache: jackson-databind-2.2.2.jar
[info] Including from cache: paranamer-2.5.6.jar
[info] Including from cache: commons-io-2.3.jar
[info] Including from cache: scala-inflector_2.9.1-1.3.5.jar
[info] Including from cache: json4s-jackson_2.9.1-3.2.5.jar
[info] Including from cache: mockito-all-1.9.0.jar
[info] Including from cache: scallop_2.9.1-0.9.4.jar
[info] Including from cache: scalate-core_2.9-1.6.1.jar
[info] Including from cache: scalate-util_2.9-1.6.1.jar
[info] Including from cache: scala-compiler-2.9.1.jar
[info] Including from cache: scala-library-2.9.1.jar
[info] Including from cache: scalap-2.9.1.jar
[info] Including from cache: slf4j-api-1.6.1.jar
[warn] Merging 'META-INF/MANIFEST.MF' with strategy 'discard'
[warn] Strategy 'discard' was applied to a file
[info] Checking every *.class/*.jar file's SHA-1.
[info] Assembly up to date: /Users/jecz/Apache/swagger-codegen-master/target/scala-2.9.1/swagger-codegen.jar
[success] Total time: 26 s, completed Nov 1, 2013 9:49:34 AM

执行“./bin/scala-petstore.sh”

 Please set scalaVersion := "2.10.3" in build.sbt and run ./sbt assembly

4 个答案:

答案 0 :(得分:4)

我有同样的问题。问题是:

我安装了scala 2.10.2,sbt在一个名为scala-2.10的文件夹中构建它,这由php-petstore.sh文件中的这一行处理:

if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then

使用bin / Version.scale,它将带有补丁的版本号映射到版本号,只有主要版本和次要版本。由于2.10.3未映射到2.10,因此会发生错误。

val version = scala.util.Properties.scalaPropOrElse("version.number", "unknown").toString match {
  case "2.10.0" => "2.10"
  case e: String => e
}
println(version)

解决方案: 将2.10.0更改为2.10.3(或您正在运行的版本)

答案 1 :(得分:0)

如果你做brew安装scala的东西应该开始工作

答案 2 :(得分:0)

在更改build.sbt中的版本后,您可能忘记了“./sbt assembly”。

我也得到了:

object BeanProperty is not a member of package reflect
[error] import scala.reflect.BeanProperty

并尝试downgrade到版本2.10.4

之后有效。

答案 3 :(得分:0)

最新版本的Swagger-Codegen不再依赖Scala。您可以找到安装说明here