Versions Compared

Key

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

Prerequisites

Maven3 and Ant needs to be installed.

...

  1. Create a directory and copy the following pom.xml file.: 

    Example:Sample  Sample pom.xml file  file to create a new feature installed distribution. Please replace <PRODUCT_HOME> with the name of your product. E.g., ESB-4.8.1.

    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>Creating custom distribution</name>
    	    <name>New feature</name>
        <url>http://wso2.org</url>
    	    <build>
    		<plugins>
    			<plugin>
    				        <plugins>
                <plugin>
                    <groupId>org.wso2.maven</groupId>
    				
                    <artifactId>carbon-p2-plugin</artifactId>
    				
                    <version>1.5.1<4</version>
    				<executions>
    					<execution>
    						                <executions>
                        <execution>
                            <id>feature-install</id>
    						<phase>package</phase>
    						<goals>
    							
                            <phase>package</phase>
                            <goals>
                                <goal>p2-profile-gen</goal>
    						</goals>
    						<configuration>
    							<profile>WSO2CarbonProfile</profile>
    							
                            </goals>
                            <configuration>
                                <profile>$profile</profile>
                                <metadataRepository>file:p2-repo</metadataRepository>
    							
                                <artifactRepository>file:p2-repo</artifactRepository>
    							                            <destination>$distribution_name/repository/components</destination>
    							<deleteOldProfileFiles>true</deleteOldProfileFiles>
    							<features>
    								<feature>
    									
                                <deleteOldProfileFiles>false</deleteOldProfileFiles>
                                <features>
                                    <feature>
                                        <id>org.wso2.carbon.tryit.feature.group</id>
    									<version>4.1.0</version>
    								</feature>
    							</features>
    						</configuration>
    					</execution>
    				</executions>
    			</plugin>
    			<plugin>
    				
                                        <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>
    								
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <configuration>
                                <tasks>
                                    <replace token="false" value="true" dir="$distribution_name/repository/components/$profile/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>
    			
                                    </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-maven2-repository</id>
    			<url>http://dist.wso2.org/maven2</url>
    		</pluginRepository>
    		<pluginRepository>
    			<id>wso2-maven2-repository</id>
    			<url>http://dist.wso2.org/snapshots/maven2</url>
    		</pluginRepository>
    	
                <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
    For more information on the 

    Read more about the following plugins:

    please go to http://maven.apache.org/plugins/maven-antrun-plugin/.
  2. Unzip the original product distribution (e.g., wso2carbon-<version>.zip) and the relevant p2 repository (e.g., http://dist.wso2.org/products/carbon/<version>/p2-repo.zip) to the same directory location. 
  3. Replace the $distribution_name params found in pom.xml file, with the unzipped product distribution name (e.g., wso2carbon-<version>
  4. In the pom.xml file list down the features you want to install into the system. 
    Example:

    Code Block
     <feature> 
       <id>org.wso2.carbon.tryit.feature.group</id> 
       <version>4.13.0</version> 
    </feature>
     
  5. 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.