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:
Add the dependency
dependency "org.jsoup:jsoup:1.14.3"to the root build.gradle of the Nice2 project in thedependencyManagementblockInclude the dependency
implementation "org.jsoup:jsoup"in thebuild.gradleof the:optional:addressmodule (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 |
|---|---|---|
|
path to the jar |
|
|
group as used in the Gradle dependency |
|
|
name as used in the Gradle dependency |
|
|
new version, |
|
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:
Find check for outdated dependencies on the Schedules page.
Open the last pipeline (link in column Last Pipeline).
Open job list-outdated-dependencies
Browse job artifacts (right panel)
Open report.txt