Maven原型来自artifactId的骆驼案例文件名?

问题描述 投票:6回答:1

对于Maven原型,如何使用${artifactId}中的archetype-metadata.xml大小写生成的文件名?例如,sample-my应为SampleMy.java

我以为这需要作为速度模板,但这需要在archetype-metadata.xml中指定一个宏。可以在pluginApp。java中创建该宏,如下所示:

https://github.com/arun-gupta/spigot-archetype/blob/master/src/main/resources/archetype-resources/src/main/java/pluginApp.java#L4-L7

如何完成archetype-metadata.xml

确切的片段在:

https://github.com/arun-gupta/spigot-archetype/blob/master/src/main/resources/META-INF/maven/archetype-metadata.xml#L14

maven velocity minecraft archetypes
1个回答
0
投票

我如下修复:

    <requiredProperty key="classPrefix" >
        <defaultValue>
            ${package.getClass().forName("org.apache.velocity.util.StringUtils").removeAndHump("$artifactId", "-")}
        </defaultValue>
    </requiredProperty>
© www.soinside.com 2019 - 2024. All rights reserved.