Please find what I do:

      <plugin>        <groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>        <executions>
         <execution>            <id>initialize-parse-version</id>
      <phase>initialize</phase>            <goals>
<goal>parse-version</goal>            </goals>
<configuration>              <propertyPrefix>osgi</propertyPrefix>
       </configuration>          </execution>          <execution>
       <id>initialize-timestamp</id>
<phase>initialize</phase>            <goals>
<goal>timestamp-property</goal>            </goals>
<configuration>              <name>osgi.buildtime</name>
<pattern>'v'yyyyMMddhhmmss</pattern>            </configuration>
   </execution>          <execution>
<id>initialize-regex</id>            <phase>initialize</phase>
   <goals>              <goal>regex-property</goal>
</goals>            <configuration>
<name>osgi.osgiVersion</name>
<value>${osgi.osgiVersion}</value>
<regex>SNAPSHOT</regex>
<replacement>${osgi.buildtime}</replacement>
<failIfNoMatch>false</failIfNoMatch>            </configuration>
   </execution>        </executions>      </plugin>



On Fri, Jun 26, 2015 at 11:32 PM, Benson Margulies <[email protected]>
wrote:

> We don't seem to have a mojo user mailing list post-codehaus, do we?
>
> I'm trying to use the regexPropertySettings goal to map from Maven
> version to OSGi version, since I need the OSGi version in more places
> than just the manifest.
>
> I can't figure out how to account for -SNAPSHOT well. It does not work
> very well to specify two 'setting' blocks for the same value; it just
> uses the second -- and I can't figure out how to write a
> regex/replacement pair that maps -SNAPSHOT to _SNAPSHOT if present,
> and to nothing if absent, while also doing other things.
>
> <execution>
>     <id>osgi-version</id>
>     <goals>
>         <goal>regex-properties</goal>
>     </goals>
>     <phase>generate-resources</phase>
>     <configuration>
>         <regexPropertySettings>
>             <regexPropertySetting>
>                 <name>osgi-version</name>
>                 <value>${project.version}</value>
>                 <regex>${osgi-version-regex}</regex>
>                 <replacement>${osgi-version-replacement}</replacement>
>                 <failIfNoMatch>false</failIfNoMatch>
>             </regexPropertySetting>
>         </regexPropertySettings>
>     </configuration>
> </execution>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


-- 
Jeff MAURY


"Legacy code" often differs from its suggested alternative by actually
working and scaling.
 - Bjarne Stroustrup

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com
http://www.twitter.com/jeffmaury

Reply via email to