I'm trying to create a Maven Archetype for a Java web app and I have some JavaScript files I want it to generate. Is it possible to use Maven Archetype properties in the JavaScript file such that it will get replaced by the defined value at generation?
example.js
#set( $symbol_escape = '$' )
var name = "${artifactId}"
The above doesn't appear to work. I've tried other properties as well. It would seem it just isn't supported. Maybe due to collision possibilities with '$'?
The end resulting example.js file that is created just has the text "${artifactId}" instead of replacing it with the value of the property artifactId.
I'm using Maven Archetype plugin/extension version 2.2.
archetype-metadata.xml
...
<fileSet filtered="true" encoding="UTF-8">
<directory>src/main/javascript</directory>
<includes>
<include>**/*.js</include>
</includes>
</fileSet>
JS Path: src/main/javascript/my/package/name/example.js
You should add a
<build>
...
<resources>
<resource>
<directory>src/main</directory>
<filtering>true</filtering>
<includes>
<include>**/*.js</include>
</includes>
</resource>
</resources>
...
in your pom.xml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With