This is an internal documentation. There is a good chance you’re looking for something else. See Disclaimer.

External Dependencies

Dependency management in root build.gradle

All external dependencies should be added to the dependencyManagement block in the root build.gradle. This way, they can be managed in one single place which makes it much easier to keep them up to date.

Each dependency is added with the desired version number to the dependencyManagement block. Once defined there, there is no version number needed in the dependency declaration in the actual module where the dependency is included.

Example

Imagine we need the dependency org.jsoup:jsoup in the module :optional:address. We further assume, that the current version of JSOUP is 1.10.3.

The dependency would be included as follows:

  1. Add the dependency dependency "org.jsoup:jsoup:1.14.3" to the root build.gradle of the Nice2 project in the dependencyManagement block

  2. Include the dependency implementation "org.jsoup:jsoup" in the build.gradle of the :optional:address module (don’t specify a version). If the dependency is used in the api or spi package of the module the dependency should be added as api dependency (api "org.jsoup:jsoup").

Hint

If you need to manage a set of dependencies which share the same version number, it makes sense to define a variable for that version number gradle.properties (e.g. jsoupVersion=1.10.3) which can be used for all dependencies in the dependencyManagement (e.g. dependency "org.jsoup:jsoup:${jsoupVersion}").

Dependencies not on Maven Central

Artifacts not available on Maven Central (patched libraries, our own libraries) go into the tocco repository on https://maven.tocco.ch/tocco (VPN required).

Create the file settings.xml in the directory .m2 in your home directory (/home/<USER>/.m2/settings.xml) once, Maven creates the directory but not the file. Use the tocco token from the Ansible vault (secrets.reposilite.tocco) and make it readable for you only (chmod 600):

<settings>
  <servers>
    <server>
      <id>tocco</id>
      <username>tocco</username>
      <password><TOKEN_SECRET></password>
    </server>
  </servers>
</settings>

Upload (Maven generates the .pom and maven-metadata.xml):

mvn deploy:deploy-file -DrepositoryId=tocco -Durl=https://maven.tocco.ch/tocco \
  -Dfile=<FILE> -DgroupId=<GROUP_ID> -DartifactId=<ARTIFACT_ID> -Dversion=<VERSION>

placeholder

meaning

example

<FILE>

path to the jar

target/ant/dwr.jar

<GROUP_ID>

group as used in the Gradle dependency

org.directwebremoting

<ARTIFACT_ID>

name as used in the Gradle dependency

dwr

<VERSION>

new version, -tocco for patched libs

3.0.4-tocco

The dependency org.directwebremoting:dwr:3.0.4-tocco is <GROUP_ID>:<ARTIFACT_ID>:<VERSION>.

Use -DpomFile=<POM_FILE> instead of group, artifact and version if a POM exists, -Dclassifier=<CLASSIFIER> for classified jars. A version can only be uploaded once.

Update backend dependencies on a regular basis

It’s important to keep all dependencies up to date. Therefore, there’s a weekly job on GitLab which generates a report of all dependencies which are out-of-date. The job runs every Saturday.

Find the latest report:

  1. Find check for outdated dependencies on the Schedules page.

  2. Open the last pipeline (link in column Last Pipeline).

  3. Open job list-outdated-dependencies

  4. Browse job artifacts (right panel)

  5. Open report.txt