Goal to transform a maven version into an OSGi version
------------------------------------------------------

                 Key: FELIX-1568
                 URL: https://issues.apache.org/jira/browse/FELIX-1568
             Project: Felix
          Issue Type: New Feature
          Components: Maven Bundle Plugin
            Reporter: Guillaume Nodet
             Fix For: maven-bundle-plugin-2.1.0


I found a workaround which is the following xml snippet, but a built-in goal 
would be way easier ;-)

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.2</version>
                <executions>
                    <execution>
                        <id>create-prop</id>
                        <phase>generate-resources</phase>
                        <configuration>
                            <tasks>
                                <taskdef 
resource="net/sf/antcontrib/antcontrib.properties" 
classpathref="maven.plugin.classpath"/>
                                <property name="ant.regexp.regexpimpl" 
value="org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp"/>
                                <property name="mv" value="${project.version}"/>
                                <echo message="Maven version:   ${mv}" />
                                <propertyregex property="ov.p1" input="${mv}" 
regexp="(\d+)(?:\.(\d+)(?:\.(\d+))?)?(?:[^a-zA-Z0-9](.*))?" replace="\1" 
defaultValue="0"/>
                                <propertyregex property="ov.p2" input="${mv}" 
regexp="(\d+)(?:\.(\d+)(?:\.(\d+))?)?(?:[^a-zA-Z0-9](.*))?" replace=".\2" 
defaultValue=".0"/>
                                <propertyregex property="ov.p3" input="${mv}" 
regexp="(\d+)(?:\.(\d+)(?:\.(\d+))?)?(?:[^a-zA-Z0-9](.*))?" replace=".\3" 
defaultValue=".0"/>
                                <propertyregex property="ov.p4" input="${mv}" 
regexp="(\d+)(?:\.(\d+)(?:\.(\d+))?)?(?:[^a-zA-Z0-9](.*))?" replace=".\4" 
defaultValue=""/>
                                <propertyregex property="ov.p1a" 
input="${ov.p1}" regexp="(.+)" replace="\1" defaultValue="0"/>
                                <propertyregex property="ov.p2a" 
input="${ov.p2}" regexp="(\..+)" replace="\1" defaultValue=".0"/>
                                <propertyregex property="ov.p3a" 
input="${ov.p3}" regexp="(\..+)" replace="\1" defaultValue=".0"/>
                                <propertyregex property="ov.p4a" 
input="${ov.p4}" regexp="(\..+)" replace="\1" defaultValue=""/>
                                <property name="ov" 
value="${ov.p1a}${ov.p2a}${ov.p3a}${ov.p4a}"/>
                                <echo message="OSGi version:    ${ov}" />
                                <mkdir dir="target"/>
                                <echo message="karaf.osgi.version = ${ov}" 
file="target/filter.txt"/>
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>ant-contrib</groupId>
                        <artifactId>ant-contrib</artifactId>
                        <version>1.0b3</version>
                    </dependency>
                    <dependency>
                        <groupId>ant</groupId>
                        <artifactId>ant-optional</artifactId>
                        <version>1.5.3-1</version>
                    </dependency>
               </dependencies>
            </plugin>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to