Hi, In addition to the suggestion of others to use parse-version, the build-helper-maven-plugin also has the regex-property goal, which lets you assign a property based on a regex. Here is an example:
<execution> <id>sanitize-version</id> <goals> <goal>regex-property</goal> </goals> <configuration> <name>sanitizedVersion</name> <value>${project.version}</value> <regex>^([0-9]+)\.([0-9]+)\.([0-9]+).*$</regex> <replacement>$1.$2.$3</replacement> <failIfNoMatch>false</failIfNoMatch> </configuration> </execution> Regards, Curtis -- Curtis Rueden LOCI software architect - http://loci.wisc.edu/software ImageJ2 lead, Fiji maintainer - http://imagej.net/User:Rueden On Tue, Jan 3, 2017 at 12:32 PM, Guillaume Boué <guillaume_b...@orange.fr> wrote: > Hi, > > It sounds like you're looking for the parse-version goal of the > build-helper-maven-plugin: http://www.mojohaus.org/build- > helper-maven-plugin/parse-version-mojo.html. It can decompose the project > version into several Maven properties. There is an example of usage here > http://www.mojohaus.org/build-helper-maven-plugin/usage.html > #Access_the_parsed_components_of_a_project_version. > > Guillaume > > > > Le 03/01/2017 à 19:25, org.apache.maven.u...@io7m.com a écrit : > >> Hello. >> >> I have a small project that contains a plugin for Blender[0]. Plugins >> in Blender are Python files that must contain a hash value at the top >> of the file containing version information. The version information has >> to be numeric constants as Blender actually parses this data rather >> than evaluating it in an interpreter. >> >> https://github.com/io7m/smf/blob/develop/io7m-smfj-blender/ >> src/main/resources/__init__.py >> >> Right now, I'm having to remember to manually insert the right version >> number each time I increment the Maven version. I'd much rather filter >> the Python source file as a resource instead, but unfortunately I'd >> need to transform the Maven version string: >> >> 2.3.1 → (2, 3, 1) >> >> Is there an existing plugin that can do this? I assume that it'd be >> some sort of templating engine. Unfortunately, all of the search >> results for that seem to be in regards to the site plugin. >> >> M >> >> [0] http://blender.org >> > > > --- > L'absence de virus dans ce courrier électronique a été vérifiée par le > logiciel antivirus Avast. > https://www.avast.com/antivirus > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > >