Search code examples
javamavenmaven-archetype

How to create text file automatically using custom maven archetype


How to set value of key for creating file given path in fileset in archetype-metadata.xml . <requiredProperties> <requiredProperty key="??" /> <requiredProperties/>

        <fileSet filtered="true">
        <directory>src/main/resources</directory>

        <!--Filters example -->
        <includes>
            <include>*.txt</include>
            <include>*.properties</include> 
        </includes>
        <excludes>
            <exclude>**/*.xml</exclude>
        </excludes>
    </fileSet>

Thanks in advance


Solution

  • I found solution myself.No,we can't do it in automatically without text file placed in respectively path.Please find screen shot for your reference.

    Place text file in archetype-resources and get text file name from user input example:ex.txt text file place

    Generated archetype template here you see ex.txt is created in given specific path.

    Thanks.

    enter image description here