Remove duplicate groupId declaration
[odlparent.git] / features-parent / pom.xml
index 39013acc8af395e0c20db57c75cd36403af290ff..37524e25da5a1a0db856fa1132e977e0cd073212 100644 (file)
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent</artifactId>
-        <version>1.5.0-SNAPSHOT</version>
+        <version>1.6.0-SNAPSHOT</version>
         <relativePath>../odlparent</relativePath>
     </parent>
 
-    <groupId>org.opendaylight.odlparent</groupId>
     <artifactId>features-parent</artifactId>
     <packaging>pom</packaging>
 
     <properties>
         <features.file>features.xml</features.file>
+        <skip.karaf.featureTest>false</skip.karaf.featureTest>
     </properties>
 
     <build>
                                 <language>groovy</language>
                                 <script>
                                     /**
-                                     * Placeholder, which is used in src/feature/features.xml
+                                     * Placeholder, which is used in src/features/features.xml
                                      * to mark version which should be inserted from dependencies.
                                      * Currently works only for bundle and configfile tags
-                                     * with mvn: url schema, and needs to be used 
+                                     * with mvn: url schema, and needs to be used
                                      * as third component of schema.
                                      * eg. mvn:group/artefact/{{VERSION}}
                                      */
@@ -86,7 +86,7 @@
                                      * This will be processed by this script.
                                      *
                                      */
-                                    def featureFilePath = "src/main/feature/features.xml"
+                                    def featureFilePath = "src/main/features/features.xml"
                                     // Contains mapping of groupID:artefactID to versoin
                                     def versionMap = new HashMap();
                                     /* Loads transitive dependency list generated from
                                     def dependencies = new File(project.build.directory,"dependencies.txt")
                                     dependencies.eachLine {
                                         def cmps = it.trim().split(":")
-                                        // 0 - groupId
-                                        // 1 - artifactId
-                                        // 2 - Type
-                                        // 3 - Version
-                                        if(cmps.length >= 4) {
+                                        // Depends on number of components:
+                                        //  - groupId
+                                        //  - artifactId
+                                        //  - Type
+                                        //  - Qualifier (optional)
+                                        //  - Version
+                                        //  - Scope
+                                        if(cmps.length > 4) {
                                             def id = cmps[0] + ":" + cmps[1]
-                                            versionMap[id] = cmps[3]
+                                            if(cmps.length == 6) {
+                                                versionMap[id] = cmps[4]
+                                            } else if(cmps.length == 5) {
+                                                versionMap[id] = cmps[3]
+                                            }
                                         }
                                     }
 
                                         throw new IllegalArgumentException("Feature dependency $groupId:$artifactId is not dependecy of project.")
                                     }
 
-
-                                    def updateMavenDependency  = { dep ->
-                                       def mvnUrl = dep.text()
-                                       if(mvnUrl.startsWith("mvn:")) {
-                                         def components =  mvnUrl.substring(4).split("/")
-                                         if(components[2] == versionPlaceholder) {
-                                         dep.value = updatedURLFromProject(components)
-                                         }
-                                       }
+                                    def updateMavenDependency = { dep ->
+                                        def mvnUrl = dep.text()
+                                        if (mvnUrl.startsWith("mvn:")) {
+                                            def components =  mvnUrl.substring(4).split("/")
+                                            if (components[2] == versionPlaceholder) {
+                                                dep.value = updatedURLFromProject(components)
+                                            }
+                                        } else if (mvnUrl.startsWith("wrap:mvn:")) {
+                                            def components =  mvnUrl.substring(9).split("/")
+                                            if (components[2] == versionPlaceholder) {
+                                                dep.value = "wrap:" + updatedURLFromProject(components)
+                                            }
+                                        }
                                     }
 
                                     def featureFile = new File(project.basedir,featureFilePath)
                                     def root = new XmlParser().parse(featureFile)
 
+                                    println "[INFO] Updating repository declarations"
+                                    root.repository.each updateMavenDependency
+
                                     root.feature.each { feature ->
                                         println "[INFO] Processing feature: ${feature.@name}"
                                         feature.bundle.each updateMavenDependency
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-surefire-plugin</artifactId>
                     <configuration>
+                        <skip>${skip.karaf.featureTest}</skip>
                         <dependenciesToScan>
                             <dependency>org.opendaylight.odlparent:features-test</dependency>
                         </dependenciesToScan>
                     </configuration>
                 </plugin>
+                <!-- Ignore/Execute plugin execution -->
+                <plugin>
+                  <groupId>org.eclipse.m2e</groupId>
+                  <artifactId>lifecycle-mapping</artifactId>
+                  <version>1.0.0</version>
+                  <configuration>
+                    <lifecycleMappingMetadata>
+                      <pluginExecutions>
+                        <pluginExecution>
+                          <pluginExecutionFilter>
+                            <groupId>com.alexecollins.maven.plugin</groupId>
+                            <artifactId>script-maven-plugin</artifactId>
+                            <versionRange>[0.0,)</versionRange>
+                            <goals>
+                              <goal>execute</goal>
+                            </goals>
+                          </pluginExecutionFilter>
+                          <action>
+                            <ignore/>
+                          </action>
+                        </pluginExecution>
+                        <pluginExecution>
+                          <pluginExecutionFilter>
+                            <groupId>org.apache.maven.plugins</groupId>
+                            <artifactId>maven-dependency-plugin</artifactId>
+                            <versionRange>[0.0,)</versionRange>
+                            <goals>
+                              <goal>resolve</goal>
+                            </goals>
+                          </pluginExecutionFilter>
+                          <action>
+                            <ignore/>
+                          </action>
+                        </pluginExecution>
+                     </pluginExecutions>
+                   </lifecycleMappingMetadata>
+                  </configuration>
+                </plugin>
             </plugins>
         </pluginManagement>
 
         <dependency>
             <groupId>org.opendaylight.odlparent</groupId>
             <artifactId>features-test</artifactId>
-            <version>1.5.0-SNAPSHOT</version>
+            <version>1.6.0-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
     </dependencies>