This documentation is for WSO2 Carbon 4.4.6. View documentation for the latest release.
Page Comparison - Setting up a Git Repository (v.2 vs v.3) - Carbon 4.4.6 - WSO2 Documentation

Versions Compared

Key

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

...

  1. Eliminate the pom files available in the componentservice-stub and features directories of your project. Instead, directly call the real Maven modules from the parent pom file. For example,

    Code Block
    <modules>
            <module>service-stubs/service-mgt</module>
            <module>service-stubs/webapp-mgt</module>
            <module>components/service-mgt</module>
            <module>components/webapp-mgt</module>
            <module>features/as-runtimes</module>
            <module>features/service-mgt</module>
            <module>features/webapp-mgt</module>
     </modules>

    You can keep the same directory structure to enhance human readability.

  2. Make sure you have defined the following repositories (including plugin repositories) on the parent pom file. These will be used to drag SNAPSHOT versions of other Carbon projects that are used as dependencies of your project.

    Code Block
    <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>
    
            <repository>
                <id>wso2.releases</id>
                <name>WSO2 internal Repository</name>
                <url>http://maven.wso2.org/nexus/content/repositories/releases/</url>
                <releases>
                    <enabled>true</enabled>
                    <updatePolicy>daily</updatePolicy>
                    <checksumPolicy>ignore</checksumPolicy>
                </releases>
            </repository>
    
            <repository>
                <id>wso2.snapshots</id>
                <name>Apache Snapshot Repository</name>
                <url>http://maven.wso2.org/nexus/content/repositories/snapshots/</url>
                <snapshots>
                    <enabled>true</enabled>
                    <updatePolicy>daily</updatePolicy>
                </snapshots>
                <releases>
                    <enabled>false</enabled>
                </releases>
            </repository>
    </repositories>
    
    <pluginRepositories>
    
            <pluginRepository>
                <id>wso2.releases</id>
                <name>WSO2 internal Repository</name>
                <url>http://maven.wso2.org/nexus/content/repositories/releases/</url>
                <releases>
                    <enabled>true</enabled>
                    <updatePolicy>daily</updatePolicy>
                    <checksumPolicy>ignore</checksumPolicy>
                </releases>
            </pluginRepository>
    
            <pluginRepository>
                <id>wso2.snapshots</id>
                <name>Apache Snapshot Repository</name>
                <url>http://maven.wso2.org/nexus/content/repositories/snapshots/</url>
                <snapshots>
                    <enabled>true</enabled>
                    <updatePolicy>daily</updatePolicy>
                </snapshots>
                <releases>
                    <enabled>false</enabled>
                </releases>
            </pluginRepository>
    
            <pluginRepository>
                <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>
            </pluginRepository>
    
    </pluginRepositories>
  3. Update the project parent pom with the correct SCM configuration as shown below.

    Code Block
    <scm>
       <url>https://github.com/wso2/carbon4-kernel.git</url>
       <developerConnection>scm:git:https://github.com/wso2/carbon4-kernel.git</developerConnection>
       <connection>scm:git:https://github.com/wso2/carbon4-kernel.git</connection>
       <tag>HEAD</tag>
    </scm>

    Then, remove all the scm configurations from the child poms.

  4. Add a <dependencyManagement> section to the project's parent pom file if you have multiple modules in your project. This defines all your project dependencies along with versions.  

    Note

    Note that you cannot have <dependencyManagement> sections on any other pom file other than the parent pom. When you add dependencies in the pom files of sub-modules, ensure that you don't specify the version, because it is already specified in the parent pom file under the <dependencyManagement> section.

  5. In the parent pom file, define the scope for all dependencies used by product integration tests. See the following examples:
    Example 1: Define the dependencies required for integration tests using the "tests" scope.

    Code Block
    <dependency>
               <groupId>org.wso2.carbon</groupId>
               <artifactId>org.wso2.carbon.aarservices.stub</artifactId>
               <version>${stub.version}</version>
               <scope>test</scope>
    </dependency>
    <dependency>
               <groupId>org.wso2.carbon</groupId>
               <artifactId>org.wso2.carbon.webapp.mgt.stub</artifactId>
               <version>${stub.version}</version>
               <scope>test</scope>
    </dependency>

    Example 2: Dependencies without scope properties.

    Code Block
    <dependency>
                <groupId>org.wso2.carbon</groupId>
                <artifactId>org.wso2.carbon.aarservices.stub</artifactId>
    </dependency>
    
    <dependency>
                <groupId>org.wso2.carbon</groupId>
                <artifactId>org.wso2.carbon.webapp.mgt.stub</artifactId>
    </dependency>

    Example 3: Overwrite the dependency scope with "compile" if you need to use test dependencies with java modules like common utility modules.

    Code Block
    <dependency>
                <groupId>org.wso2.carbon</groupId>
                <artifactId>org.wso2.carbon.aarservices.stub</artifactId>
                <scope>compile</scope>
    </dependency>
    <dependency>
                <groupId>org.wso2.carbon</groupId>
                <artifactId>org.wso2.carbon.webapp.mgt.stub</artifactId>
                <scope>compile</scope>
    </dependency>
  6. Update the project parent pom with the WSO2 Master parent pom as shown below. The WSO2 Mater parent pom holds all the common things that are used in almost all the repositories, such as distributionManagement, pluginManagement, repositories, pluginRepositories, etc.

    Code Block
    <parent>
        <groupId>org.wso2</groupId>
        <artifactId>wso2</artifactId>
        <version>5</version>
    </parent> 
    Info

    Make sure that your parent-child pom hierarchy is followed in all the sub-modules. That is, a child sub-module cannot have a parent pom reference to an external pom. The parent pom references should be self-contained except in the above instance, where the project root pom’s parent reference is set to the WSO2 Master parent pom ("org.wso2:wso2:1").

  7. Add the plugins given below to the <build> section in the project parent pom. The versions of these will be inherited from the WSO2 Master parent pom.

    Code Block
    <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-release-plugin</artifactId>
           <configuration>
               <preparationGoals>clean install</preparationGoals>
           </configuration>
       </plugin>
       <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-deploy-plugin</artifactId>
       </plugin>

    Note: You can add the autoVersionSubmodules configuration parameter to release the plugin configuration section, which will automatically version the sub modules. However, please note that this will cause issues with versioning if your project has an orbit sub-module. This is because, for orbit modules, we follow a different versioning convention.

  8. Remove <distributionManagement> from the project parent pom. This step is mandatory as the repositories for the <distributionManagement> section is inherited from the WSO2 Master parent pom.

  9. Add a server config element in the maven configuration (<MVN_HOME>/conf/settings.xml) for the nexus-releases server configuration given above. The nexus user credentials that will be used for remote artifact deployment are as follows:

    Code Block
    <server>
       <id>nexus-releases</id>
       <username>username</username>
       <password>password</password>
    </server>

    Note: For the above step, you can request WSO2 Infra to create a user for the project in nexus.

  10. Add another server config element that stores the SCM related credentials. This is an optional step, but will be useful to hide your SCM credentials when using the mvn-release-plugin.

    Code Block
    <server>
       <id>scm-server</id>
       <username>username</username>
       <password>password</password>
    </server>

    After adding the above, you have to update the parent pom properties section of your project with the following property: “project.scm.id”:

    Code Block
    <properties>
        <project.scm.id>scm-server</project.scm.id>
    </properties>
  11. Make sure that the project does not have any SNAPSHOT dependencies and update those with released versions. If there are unreleased SNAPSHOT dependencies, we will have to release them separately. This will be checked by the release plugin during the release:prepare stage.

  12. Then, make sure that you have properly parameterized the versions of dependencies. That is,  the dependencies from the carbon-identity repository should have a version parameter called ‘carbon.identity.version’. It’s unacceptable to have a versions version such as ‘carbon.platform.version’ or ‘wso2carbon.version’. You need version parameters according to the repo.