开发者

Setting velocity properties

I have occurence bui开发者_运维技巧lding a maven archetype where I want to do something like this

#set( $controllerPackage = ${package}\.${artifactId})

i.e. set the controllerPackage variable to equal the result of string concatentaion of the following three elements ($package,'.',$artifactId)

However this is obvioulsy not correct syntax - I get this

Lexical error: org.apache.velocity.runtime.parser.TokenMgrError: Lexical error at line 4, column 40. Encountered: "." (46), after : "\"

Is there a way I can include a period in my outputted string?


To construct a string, use quotes.

#set( $controllerPackage = "${package}.${artifactId}" )


You can use + for string concatenation:

#set( $controllerPackage = ${package} + "." + ${artifactId})
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜