<commit_before>---
Title: Upgrading
Added: v4.0.0
Last reviewed: 2019-01-29
---
# Upgrading an SDK 3.0 project to SDK 4.0

In these instructions, "base" refers to a freshly instantiated SDK 4.0 and "target" refers to the SDK 3.0.1 project that is being upgraded.

## Download a base

Download or instantiate an SDK 4.0 project to use as a base for copying files.

For example, you might create a new project called "test-aio-400" to use as a base from which to copy files into the target project that is to be upgraded.

## Remove unnecessary files

1. Remove the root src directory from the root of the target project.

2. Remove run.\* and debug.\* from the root of the target project.

## Copy run scripts from base to target

1. Copy run.bat and run.sh from base to target project

## Copy the docker directory from base into target

1. Recursively copy the docker directory from base into target

2. Clean up references in the docker-compose.yml file

In the docker directory copied from the base, edit the docker-compose.yml file to change references to the base project name to the target project name.

## Copy the platform-docker directory into target

1. Recursively copy the *-platform-docker directory into target

2. Rename the directory. The name of the directory should follow the same pattern as the existing project. For example, if the existing project is test-aio-301 then the platform-docker directory should be called test-aio-301-platform-docker.

## Clean up references in the platform-docker directory in target

1. If you copied a target directory from the base, remove it.
2. Change references in alfresco-global.properties from the base project name to the target.
3. Change references in pom.xml from the base project name to the target.
4. Change references in hotswap-agent.properties from the base project name to the target.

## Copy the share-docker directory into target

1. Recursively copy the *-share-docker directory into target

Similar to previous step, the directory should follow the same pattern as the existing project.

## Clean up references in the share-docker directory in target

1. If you copied a target directory from the base, remove it.
2. Change references in alfresco-global.properties from the base project name to the target.
3. Change references in pom.xml from the base project name to the target.
4. Change references in hotswap-agent.properties from the base project name to the target.

## Merge the root pom.xml file

Need to smartly do this merge so that target project maintains its dependencies, name, version, description, etc.

1. Copy the entire `<properties>` element from the base 4.0 pom.xml into the target 3.0 pom.xml, replacing the existing one completely.

2. Change the `acs.host` property to match the target project name.

3. Replace the `alfresco-repository` dependency as follows. Change

        <dependency>
            <groupId>${alfresco.groupId}</groupId>
            <artifactId>alfresco-repository</artifactId>
        </dependency>

    to:

        <dependency>
            <groupId>${alfresco.groupId}</groupId>
            <artifactId>alfresco-remote-api</artifactId>
            <scope>provided</scope>
        </dependency>

3. Remove the `spring-context` dependency from the target pom.xml:

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>3.2.17.RELEASE</version>
            <scope>test</scope>
        </dependency>

4. Under dependencyManagement, the platform distribution dependency needs to have its artifactId updated. Change:

        <dependency>
            <groupId>${alfresco.groupId}</groupId>
            <artifactId>alfresco-platform-distribution</artifactId>
            <version>${alfresco.platform.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>

    to:

        <dependency>
            <groupId>${alfresco.groupId}</groupId>
            <artifactId>${alfresco.bomDependencyArtifactId}</artifactId>
            <version>${alfresco.platform.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>

5. The `maven-resources-plugin` needs the outputDirectory adjusted. Change:

        <outputDirectory>${project.build.testOutputDirectory}</outputDirectory>

    to:

        <outputDirectory>${project.build.outputDirectory}/docker</outputDirectory>

6. Change the `testResources` directory as follows. Change:
<commit_msg>Formatting tweaks and example project name change<commit_after>---
Title: Upgrading
Added: v4.0.0
Last reviewed: 2019-01-29
---
# Upgrading an SDK 3.0 project to SDK 4.0

In these instructions, "base" refers to a freshly instantiated SDK 4.0 and "target" refers to the SDK 3.0.1 project that is being upgraded.

## Download a base

Download or instantiate an SDK 4.0 project to use as a base for copying files.

For example, you might create a new project called "test-aio-400" to use as a base from which to copy files into the target project that is to be upgraded.

## Remove unnecessary files

1. Remove the root src directory from the root of the target project.

2. Remove run.\* and debug.\* from the root of the target project.

## Copy run scripts from base to target

1. Copy run.bat and run.sh from base to target project.

## Copy the docker directory from base into target

1. Recursively copy the docker directory from base into target.

2. Clean up references in the docker-compose.yml file.

In the docker directory copied from the base, edit the docker-compose.yml file to change references to the base project name to the target project name.

## Copy the platform-docker directory into target

1. Recursively copy the \*-platform-docker directory into target

2. Rename the directory. The name of the directory should follow the same pattern as the existing project. For example, if the existing project is upgrade-test then the platform-docker directory should be called upgrade-test-platform-docker.

## Clean up references in the platform-docker directory in target

1. If you copied a target directory from the base, remove it.
2. Change references in alfresco-global.properties from the base project name to the target.
3. Change references in pom.xml from the base project name to the target.
4. Change references in hotswap-agent.properties from the base project name to the target.

## Copy the share-docker directory into target

1. Recursively copy the \*-share-docker directory into target

Similar to previous step, the directory should follow the same pattern as the existing project.

## Clean up references in the share-docker directory in target

1. If you copied a target directory from the base, remove it.
2. Change references in alfresco-global.properties from the base project name to the target.
3. Change references in pom.xml from the base project name to the target.
4. Change references in hotswap-agent.properties from the base project name to the target.

## Merge the root pom.xml file

Need to smartly do this merge so that target project maintains its dependencies, name, version, description, etc.

1. Copy the entire `<properties>` element from the base 4.0 pom.xml into the target 3.0 pom.xml, replacing the existing one completely.

2. Change the `acs.host` property to match the target project name.

3. Replace the `alfresco-repository` dependency as follows. Change

    ```
    <dependency>
        <groupId>${alfresco.groupId}</groupId>
        <artifactId>alfresco-repository</artifactId>
    </dependency>
    ```

    to:

    ```
    <dependency>
        <groupId>${alfresco.groupId}</groupId>
        <artifactId>alfresco-remote-api</artifactId>
        <scope>provided</scope>
    </dependency>
    ```

3. Remove the `spring-context` dependency from the target pom.xml:

    ```
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>3.2.17.RELEASE</version>
        <scope>test</scope>
    </dependency>
    ```

4. Under dependencyManagement, the platform distribution dependency needs to have its artifactId updated. Change:

    ```
    <dependency>
        <groupId>${alfresco.groupId}</groupId>
        <artifactId>alfresco-platform-distribution</artifactId>
        <version>${alfresco.platform.version}</version>
        <type>pom</type>
        <scope>import</scope>
    </dependency>
    ```

    to:

    ```
    <dependency>
        <groupId>${alfresco.groupId}</groupId>
        <artifactId>${alfresco.bomDependencyArtifactId}</artifactId>
        <version>${alfresco.platform.version}</version>
        <type>pom</type>
        <scope>import</scope>
    </dependency>
    ```

5. The `maven-resources-plugin` needs the outputDirectory adjusted. Change:

        <outputDirectory>${project.build.testOutputDirectory}</outputDirectory>

    to:

        <outputDirectory>${project.build.outputDirectory}/docker</outputDirectory>

6. Change the `testResources` directory as follows. Change:

{'fraction_non_alphanumeric': 0.08337922678709109, 'fraction_numerical': 0.012997026104196497, 'mean_word_length': 3.37801350048216, 'pattern_counts': {'":': 0, '<': 109, '<?xml version=': 0, '>': 109, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 12}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2342842', 'n_tokens_mistral': 2554, 'n_tokens_neox': 2345, 'n_words': 1034}