开发者

Setting velocity properties

开发者 https://www.devze.com 2023-01-25 02:23 出处:网络
I have occurence bui开发者_运维技巧lding a maven archetype where I want to do something like this

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

精彩评论

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