<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent</artifactId>
- <version>1.5.0-SNAPSHOT</version>
+ <version>1.8.5-SNAPSHOT</version>
<relativePath>../odlparent</relativePath>
</parent>
- <groupId>org.opendaylight.odlparent</groupId>
<artifactId>features-parent</artifactId>
<packaging>pom</packaging>
+ <name>ODL :: odlparent :: ${project.artifactId}</name>
<properties>
<features.file>features.xml</features.file>
+ <skip.karaf.featureTest>false</skip.karaf.featureTest>
</properties>
<build>
<!-- generate dependencies versions -->
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
+ <version>2.10</version>
<executions>
<execution>
<phase>generate-resources</phase>
<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}}
*/
* 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]
+ }
}
}
args[2] = dependencyVersion
return "mvn:" + args.join("/")
}
- throw new IllegalArgumentException("Feature dependency $groupId:$artifactId is not dependecy of project.")
+ throw new IllegalArgumentException("Feature dependency $groupId:$artifactId is not a dependency in the project pom.xml.")
}
-
- 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()
+ def prefix = ""
+ if (mvnUrl.startsWith("wrap:")) {
+ prefix = "wrap:"
+ mvnUrl = mvnUrl.substring(5)
+ }
+ if (mvnUrl.startsWith("mvn:") && mvnUrl.indexOf(versionPlaceholder) >= 0) {
+ // Process property place-holders
+ def dollarIndex;
+ while ((dollarIndex = mvnUrl.indexOf("\${")) >= 0) {
+ def closingBrace = mvnUrl.indexOf("}", dollarIndex);
+ if (closingBrace > dollarIndex) {
+ def propKey = mvnUrl.substring(dollarIndex + 2, closingBrace);
+ def propVal = project.properties[propKey];
+ mvnUrl = mvnUrl.replace("\${${propKey}}", propVal);
+ } else {
+ println "[WARN] Malformed Maven URL: ${mvnUrl}";
+ break;
+ }
+ }
+ def components = mvnUrl.substring(4).split("/")
+ if (components[2].startsWith(versionPlaceholder)) {
+ def suffix = "";
+ if (components[2].length() > versionPlaceholder.length()) {
+ suffix = components[2].substring(versionPlaceholder.length())
+ components[2] = versionPlaceholder
+ }
+ dep.value = prefix + updatedURLFromProject(components) + suffix
+ }
+ }
}
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
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.12</version>
<executions>
<execution>
<phase>generate-resources</phase>
</executions>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
+ <version>3.0.1</version>
<executions>
<execution>
<id>filter</id>
</executions>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
+ <version>${maven.surefire.version}</version>
<configuration>
+ <skip>${skip.karaf.featureTest}</skip>
+ <systemPropertyVariables>
+ <!-- Remove these properties when a better fix to Bug 6523 appears. -->
+ <karaf.distro.groupId>org.opendaylight.odlparent</karaf.distro.groupId>
+ <karaf.distro.artifactId>opendaylight-karaf-empty</karaf.distro.artifactId>
+ <karaf.distro.version>1.8.5-SNAPSHOT</karaf.distro.version>
+ </systemPropertyVariables>
<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>
<plugins>
+ <plugin>
+ <!-- This generates the META-INF/maven/dependencies.properties file
+ which is required by the versionAsInProject() used in SingleFeatureTest -->
+ <groupId>org.apache.servicemix.tooling</groupId>
+ <artifactId>depends-maven-plugin</artifactId>
+ </plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<artifactId>build-helper-maven-plugin</artifactId>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
</plugins>
<dependency>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>features-test</artifactId>
- <version>1.5.0-SNAPSHOT</version>
+ <version>1.8.5-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- Remove this dependency when a better fix for Bug 6523 appears. -->
+ <dependency>
+ <groupId>org.opendaylight.odlparent</groupId>
+ <artifactId>opendaylight-karaf-empty</artifactId>
+ <version>1.8.5-SNAPSHOT</version>
+ <type>zip</type>
<scope>test</scope>
</dependency>
</dependencies>
+
+ <!--
+ Maven Site Configuration
+
+ The following configuration is necessary for maven-site-plugin to
+ correctly identify the correct deployment path for OpenDaylight Maven
+ sites.
+ -->
+ <url>${odl.site.url}/${project.groupId}/${stream}/${project.artifactId}/</url>
+
+ <distributionManagement>
+ <site>
+ <id>opendaylight-site</id>
+ <url>${nexus.site.url}/${project.artifactId}/</url>
+ </site>
+ </distributionManagement>
</project>