Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Warning

Important!

Note that WSO2 does not recommend installing new features on standard products as this practice is not supported by WSO2 product upgrade WSO2 Update Manager (WUM). Use the instructions below only for the purpose of demo or test.

...

  1. Copy the sample pom.xml file given below to a directory on your machine.

    Code Block
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>org.wso2.sample</groupId>
        <artifactId>sample-feature-installation</artifactId>
        <version>1.0.0</version>
        <packaging>pom</packaging>
        <name>New feature</name>
        <url>http://wso2.org</url>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.wso2.maven</groupId>
                    <artifactId>carbon-p2-plugin</artifactId>
                    <version>1.5.4</version>
                    <executions>
                        <execution>
                            <id>feature-install</id>
                            <phase>package</phase>
                            <goals>
                                <goal>p2-profile-gen</goal>
                            </goals>
                            <configuration>
                                <profile>default</profile>
                                <metadataRepository>file:p2-repo</metadataRepository>
                                <artifactRepository>file:p2-repo</artifactRepository>
                                <destination>$distribution_name/repository/components</destination>
                                <deleteOldProfileFiles>false</deleteOldProfileFiles>
                                <features>
                                    <feature>
                                        <id>org.wso2.carbon.tryit.feature.group</id>
                                        <version>4.3.0</version>
                                    </feature>
                                </features>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>1.1</version>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <configuration>
                                <tasks>
                                    <replace token="false" value="true" dir="$distribution_name/repository/components/default/configuration/org.eclipse.equinox.simpleconfigurator">
                                        <include name="**/bundles.info"/>
                                    </replace>
                                </tasks>
                            </configuration>
                            <goals>
                                <goal>run</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
        <repositories>
            <repository>
                <id>wso2-nexus</id>
                <name>WSO2 internal Repository</name>
                <url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
                <releases>
                    <enabled>true</enabled>
                    <updatePolicy>daily</updatePolicy>
                    <checksumPolicy>ignore</checksumPolicy>
                </releases>
            </repository>
        </repositories>
        <pluginRepositories>
            <pluginRepository>
                <id>wso2-maven-releases-repository</id>
                <url>http://maven.wso2.org/nexus/content/repositories/releases/</url>
            </pluginRepository>
            <pluginRepository>
                <id>wso2-maven-snapshots-repository</id>
                <url>http://maven.wso2.org/nexus/content/repositories/snapshots/</url>
            </pluginRepository>
        </pluginRepositories>
    </project>
    Info

    Read more about the following plugins:

  2. The above sample pom.xml file specifies the default product profile (<profile>default</profile>) and the corresponding directory path (dir=" $distribution_name/repository/components/default/configuration/org.eclipse.equinox.simpleconfigurator ">). If your product is running on a different profile, you need to update the profile name. Read more about profiles from here.
  3. Unzip the original product distribution (e.g., wso2carbon-<version>.zip) and copy it to the same location as your pom.xml file.
  4. Replace $distribution_name in the pom.xml file with the name of the unzipped product distribution (e.g., wso2carbon-<version>). Note that if your product distribution is not in the same location as your pom.xml file, you can replace $distribution_name with the complete path to your product distribution.
  5. Now you need to specify the p2 repository from which the required features should be installed. This can be done in of two ways:
    1. Copy the relevant p2 repository to the same directory location as the pom.xml file. Note that your p2 repository can be a local repository, or a download of the WSO2 feature repository (e.g., http://product-dist.wso2.com/p2/carbon/releases/wilkes/).
    2. Replace file:p2-repo  in the pom.xml file with the direct link to the required p2 repository. For example, shown below is how the direct link to the Wilkes p2 repository of WSO2 is given in the pom.xml file:

      Code Block
      <metadataRepository>http://product-dist.wso2.com/p2/carbon/releases/wilkes/</metadataRepository>
      <artifactRepository>http://product-dist.wso2.com/p2/carbon/releases/wilkes/</artifactRepository>
  6. In the pom.xml file, list down the features you want to install into your product. For example, consider the Try It feature in the Wilkes repository of WSO2. The feature name given in the Wilkes repository is org.wso2.carbon.tryit_4.5.4. Therefore, you can add the feature ID and version to your pom.xml file as shown below. Note that the feature ID should end with 'feature.group'.

    Code Block
    <feature> 
       <id>org.wso2.carbon.tryit.feature.group</id> 
       <version>4.5.4/version> 
    </feature>
  7. Now let's add the feature to the product distribution: Open a terminal, navigate to the location of your pom.xml file and execute the following command:

    Code Block
    mvn clean install

    Upon successful invocation of the build, the product distribution is provisioned with the new features. This approach is scriptable.

...