Documentation (2024.2 Enterprise)

# Version control with Maven

Maven repositories can be used to store build artifacts and other binary files. In Helix TeamHub, you can create any number of Maven repositories in your projects.

The below is the list of resources to help you learn Maven:

- Official Maven site
- Maven in 5 Minutes

## Setting up

Setup credentials in your `~/.m2/settings.xml` file. Password can also be encrypted with master password. See the documentation for more details.

    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                          https://maven.apache.org/xsd/settings-1.0.0.xsd">
      <servers>
        <server>
          <id>helixteamhub.cloud</id>
          <username>username</username>
          <password>password</password>
        </server>
      </servers>
    </settings>

Configure repositories in your project's `pom.xml` file as required for resolving and deploying using the repository url:

    <repositories>
      <repository>
        <id>helixteamhub.cloud</id>
        <url>https://helixteamhub.cloud/acme/projects/foo/repositories/maven/bar</url>
      </repository>
    </repositories>

    <distributionManagement>
      <repository>
        <id>helixteamhub.cloud</id>
        <url>https://helixteamhub.cloud/acme/projects/foo/repositories/maven/bar</url>
      </repository>
      <snapshotRepository>
        <id>helixteamhub.cloud</id>
        <url>https://helixteamhub.cloud/acme/projects/foo/repositories/maven/bar</url>
      </snapshotRepository>
    </distributionManagement>

## Importing and managing artifacts

Other existing artifacts can also be imported to Helix TeamHub with Maven Deploy Plugin:

    cd /path/to/maven/repos

    mvn deploy:deploy-file -Durl=https://helixteamhub.cloud/acme/projects/foo/repositories/maven/bar \
                           -DrepositoryId=helixteamhub.cloud \
                           -DpomFile=junit/junit/3.8.2/junit-3.8.2.pom  \
                           -Dfile=junit/junit/3.8.2/junit-3.8.2.jar

It is also possible to access and manage artifacts with `curl`:

Upload file:

    curl -i -u user:password -T file.jar  https://helixteamhub.cloud/acme/projects/foo/repositories/maven/bar/file.jar

Download file:

    curl -i -u user:password https://helixteamhub.cloud/acme/projects/foo/repositories/maven/bar/file.jar

Delete file/directory:

    curl -i -u user:password -X DELETE https://helixteamhub.cloud/acme/projects/foo/repositories/maven/bar/file.jar

Your search for returned results

Your search for returned results