Skip to content

Maven

The Maven repository is used for storing Java projects.

Add your UID in the <grouId> tag of the main pom.xml document to start working:

 <groupId>UID.com.company</groupId>
 <artifactId>project</artifactId>
 <version>1.0</version>

Then add links to snapshots и releases in the pom.xml document:

<project>
...
<distributionManagement>
    <repository>
        <id>artifactory</id>
        <name>Releases</name>
        <url>https://artifactory.$LOC.scdc.io/repository/maven-releases</url>
    </repository>
    <snapshotRepository>
        <id>artifactory</id>
        <name>Snapshot</name>
        <url>https://artifactory.$LOC.scdc.io/repository/maven-snapshots</url>
    </snapshotRepository>
</distributionManagement>
...

Insert your data into settings.xml to get access to the repository:

<settings>
....
<servers>
    <server>
        <id>artifactory</id>
        <username>mail</username>
        <password>password</password>
    </server>
</servers>

After that you can start:

$ mvn deploy

Gradle

Gradle is an automated assambling system which is used for working with Maven repositories in SCDC Artifactory.

Here is the minimal configuration build.gradle for loading a block into a repository:

apply plugin: 'java'
apply plugin: 'maven'
group = 'UID.org.company.project'
version = '1.0.0-SNAPSHOT'
uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: "https://artifactory.$LOC.scdc.io/repository/maven-releases") {
                authentication(userName: "mail", password: "password")
            }
            snapshotRepository(url: "https://artifactory.$LOC.scdc.io/repository/maven-snapshots") {
                authentication(userName: "mail", password: "password")
            }
        }
    }
}
After configuring enter:
$ gradle upload

Artifactory Maven Team example

  • Create new team in the SCDC Artifactory (you can choose the permissions as needed)

  • Configure your pom.xml file:

    • paste the name of the recently created team into the tag in the following format
    <groupId>[USED-NAME]-team.[GROUPID-PATH]</groupId>
    
    • add the distributionManagement section at the 2nd XML level (the exact URL of the service depends on the desired location)
    <distributionManagement>
      <repository>
        <id>artifactory</id>
        <name>Releases</name>
        <url>https://[SERVICE-BASE-URL]/repository/maven-releases</url>
      </repository>
      <snapshotRepository>
        <id>artifactory</id>
        <name>Snapshot</name>
        <url>https://[SERVICE-BASE-URL]/repository/maven-snapshots</url>
      </snapshotRepository>
    </distributionManagement>
    

  • Configure your settings.xml file:

    • add the block in the sections (create the last one if it doesn't exist)
    <servers>
      <server>
        <id>artifactory</id>
        <username>[SERVICE-USERNAME]</username>
        <password>[SERVICE-PASSWORD]</password>
      </server>
    </servers>
    

  • Upload artifacts to the service (the upload method depends on the tools used)

Important

In the SCDC Artifactory, there is a simple principle of access control based on namespaces.
When you create a team, the namespace with the same name plus "-team" is available to you in the specified repository (for example in the Maven repos). When you specify a path in \ you are trying to place an artifact on this path.

Example

Team name: "simple-maven-test-project"

Available namespace:
maven-snapshots

├─ simple-maven-test-project-team
│  ├── com
│  │ └── company
│  │ └── ...
│ ├── org
│  │ └── ...
├─ [OTHER-TEAM-NAMESPACE]
│  └── ...
├─ [OTHER-PERSONAL-NAMESPACE]
│  └── ...
...