开发者

Edit source files with custom maven archetype

I have created a customer maven archetype and have it setup with some custom requiredProperties:

<requiredProperties>
    <requiredProperty key="classPrefix" />
</requiredProperties>

I can use that property to name a file, like so:

__classPrefix__Config.java

My qu开发者_高级运维estion is can I use that property inside the file. I've tried the following two variations but neither work:

public class ${classPrefix}Config
public class __classPrefix__Config


yes you can. This is a working example for _classPrefix_Config.java.

#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package};

/**
 * this is the prefixed class
 */
public class ${classPrefix}Config{ }

Please make sure you have enabled the filtering in the archetype-metadata.xml like this:

<fileSet filtered="true">

(I am working on maven 3)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜