kevinbirch / string-template-maven-plugin Goto Github PK
View Code? Open in Web Editor NEWExecute StringTemplate files during your Maven build.
License: MIT License
Execute StringTemplate files during your Maven build.
License: MIT License
Hi,
Thanks for writing this. Is it possible to change the delimiters used by the plugin, by specifying alternate delimiters in the configuration? The STGroup constructor allows you to specify alternate delimiters, and the string template documentation has several examples where $$ is used as the delimiter instead of <>. I want to generate xml, which makes the default very cumbersome.
Thanks.
StringTemplate allows loading templates from the classpath which is useful because I can bundle them in a jar and add that as a dependency to the plugin invocation. E.g.:
<groupId>com.webguys</groupId>
<artifactId>string-template-maven-plugin</artifactId>
<version>1.1</version>
<dependencies>
<dependency>
<groupId>foo.bar</groupId>
<artifactId>templates</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<configuration>
<templates>
<template>
<directory>foo/bar/templates/</directory>
<name>MyAweseomeTemplate</name>
...
</template>
</templates>
<configuration>
However, StringTemplate uses either the context classloader or the classloader used for loading stringtemplate, and this requires that the directory
entry above is a non-absolute resource path (i.e. no leading slash). However the stringtemplate plugin takes that to mean a relative directory which it expands without checking whether that actually exists.
Ideally, the plugin would check if the expanded directory exists, and if not, leave the value unmodified.
<properties>
named element values are needed, it is pointless having to provide, at least an extra 4 lines for , a element in the pom.xml, for each template! The plugin should use a stub controller when there is no controller element. <properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
Hi,
Currently we have to put our Controller code in the src/main/java. Is there any way to put the controller source code some where else, so that it will not be compiled and packed in the package.
Another problem is about resource used by controller. We don't want it been packed. Our use cases is we have some big text file from unicode standard, and we need to generate some classes and test classes based on it. The string template is simple but the controller code need to read and parse the text file.
Thanks,
[ERROR] Failed to execute goal com.webguys:string-template-maven-plugin:1.1:render (default) on project STT: Execution default of goal com.webguys:string-template-maven-plugin:1.1:render failed: An API incompatibility was encountered while executing com.webguys:string-template-maven-plugin:1.1:render: java.lang.NoSuchMethodError: org.apache.maven.execution.MavenSession.getRepositorySession()Lorg/sonatype/aether/RepositorySystemSession;
Hi Kevin,
I don't know if this considered a bug or not. In the usage page, it said: "N.B. The properties are installed into the template after the results of the controller, so if there are any name collisions then the value type will be automatically converted into a list type by StringTemplate."
But when I put two property with same name in the secion, only the last one's value showed. I think the "name collisions" in the document only means collision between controller and properties.
I saw we use Set to hold properties, may be change it to List could resolve the problem.
Regards
Hello!
I'm running into issues on some of my builds where the input template is UTF-8, but the platform upon which the plugin is executing uses a different charset. This line seems to be the culprit:
I think the plugin should respect one of the various charset-related Maven properties, if they're defined.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.