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})
精彩评论