8 .. include:: ../job-groups.rst
10 Below is a list of Maven job groups:
12 .. literalinclude:: ../../jjb/lf-maven-job-groups.yaml
22 Runs Sonar against a Maven project.
26 :java-version: Version of Java to execute Sonar with.
27 :mvn-version: Version of Maven to execute Sonar with.
28 :mvn-settings: Maven settings.xml file containing credentials to use.
30 lf-infra-maven-sonarcloud
31 -------------------------
33 Runs Sonar against a Maven project and pushes results to SonarCloud.
37 :java-version: Version of Java to execute Sonar with.
38 :mvn-version: Version of Maven to execute Sonar with.
39 :mvn-settings: Maven settings.xml file containing credentials to use.
40 :sonarcloud-project-key: SonarCloud project key.
41 :sonarcloud-project-organization: SonarCloud project organization.
42 :sonarcloud-api-token: SonarCloud API Token.
47 Calls the maven build script to perform a maven build.
51 :mvn-goals: The maven goals to perform for the build.
52 (default: clean deploy)
57 Common Jenkins configuration for Maven jobs.
62 Calls the maven deploy script to push artifacts to Nexus.
64 lf-maven-versions-plugin
65 ------------------------
67 Conditionally calls Maven versions plugin to set, update and commit the maven `versions:set`.
71 :maven-versions-plugin: Whether to call Maven versions plugin or not. (default: false)
72 :version-properties-file: Name and path of the version properties file.
73 (default: version.properties)
74 :mvn-version: Version of Maven to execute Sonar with.
75 :mvn-pom: Location of pom.xml.
76 :mvn-settings: Maven settings.xml file containing credentials to use.
81 Calls the maven stage script to push artifacts to a Nexus staging repository.
85 :mvn-global-settings: The name of the Maven global settings to use for
87 :mvn-settings: The name of settings file containing credentials for the project.
89 lf-update-java-alternatives
90 ---------------------------
92 Setup Java alternatives for the Distro.
96 :java-version: Version of Java to set as the default Java.
100 ---------------------
102 Runs a Sonatype CLM scan against a Maven project and pushes results to
105 :Optional parameters:
106 :mvn-goals: The maven goals to perform for the build.
107 (default: clean install)
115 Produces a CLM scan of the code into Nexus IQ Server.
119 - {project-name}-maven-clm-{stream}
123 :Comment Trigger: run-clm
125 :Required parameters:
127 :build-node: The node to run build on.
128 :jenkins-ssh-credential: Credential to use for SSH. (Generally should
129 be configured in defaults.yaml)
130 :mvn-settings: The name of settings file containing credentials for the project.
132 :Optional parameters:
134 :branch: The branch to build against. (default: master)
135 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
136 :build-timeout: Timeout in minutes before aborting build. (default: 60)
137 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
138 :java-version: Version of Java to use for the build. (default: openjdk8)
139 :mvn-global-settings: The name of the Maven global settings to use for
140 Maven configuration. (default: global-settings)
141 :mvn-goals: The maven goals to perform for the build.
142 (default: clean install)
143 :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
144 :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
145 :mvn-version: Version of maven to use. (default: mvn35)
146 :nexus-iq-namespace: Insert a namespace to project AppID for projects that
147 share a Nexus IQ system to avoid project name collision. We recommend
148 inserting a trailing - dash if using this parameter.
149 For example 'odl-'. (default: '')
150 :nexus-iq-stage: Stage the policy evaluation will be run against on
151 the Nexus IQ Server. (default: 'build')
152 :stream: Keyword that can be used to represent a release code-name.
153 Often the same as the branch. (default: master)
154 :submodule-recursive: Whether to checkout submodules recursively.
156 :submodule-timeout: Timeout (in minutes) for checkout operation.
158 :submodule-disable: Disable submodule checkout operation.
161 :gerrit_merge_triggers: Override Gerrit Triggers.
163 Maven JavaDoc Publish
164 ---------------------
166 Produces and publishes javadocs for a Maven project.
168 Expects javadocs to be available in $WORKSPACE/target/site/apidocs, unless
169 the mvn-dir parameter is supplied, in which case expects javadocs to be
170 available in $WORKSPACE/{mvn-dir}/target/site/apidocs.
174 - {project-name}-maven-javadoc-publish-{stream}-{java-version}
175 - gerrit-maven-javadoc-publish
176 - github-maven-javadoc-publish
178 :Comment Trigger: remerge
180 :Required parameters:
182 :build-node: The node to run build on.
183 :javadoc-path: The path in Nexus to deploy javadoc to.
184 :jenkins-ssh-credential: Credential to use for SSH. (Generally should
185 be configured in defaults.yaml)
186 :mvn-settings: The name of settings file containing credentials for the project.
187 :mvn-site-id: Maven Server ID from settings.xml to pull credentials from.
188 (Note: This setting should be configured in defaults.yaml.)
190 :Optional parameters:
192 :branch: The branch to build against. (default: master)
193 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
194 :build-timeout: Timeout in minutes before aborting build. (default: 60)
195 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
196 :java-version: Version of Java to use for the build. (default: openjdk8)
197 :mvn-dir: Directory supplied as argument to -f option (default: '.')
198 :mvn-global-settings: The name of the Maven global settings to use for
199 Maven configuration. (default: global-settings)
200 :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
201 :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
202 Must not include a "-f" option; see parameter mvn-dir.
203 :mvn-version: Version of maven to use. (default: mvn35)
204 :stream: Keyword that can be used to represent a release code-name.
205 Often the same as the branch. (default: master)
206 :submodule-recursive: Whether to checkout submodules recursively.
208 :submodule-timeout: Timeout (in minutes) for checkout operation.
210 :submodule-disable: Disable submodule checkout operation.
213 :gerrit_merge_triggers: Override Gerrit Triggers.
218 Produces javadocs for a Maven project.
220 Expects javadocs to be available in $WORKSPACE/target/site/apidocs, unless
221 the mvn-dir parameter is supplied, in which case expects javadocs to be
222 available in $WORKSPACE/{mvn-dir}/target/site/apidocs.
226 - {project-name}-maven-javadoc-verify-{stream}-{java-version}
227 - gerrit-maven-javadoc-verify
228 - github-maven-javadoc-verify
230 :Comment Trigger: recheck|reverify
232 :Required parameters:
233 :build-node: The node to run build on.
234 :jenkins-ssh-credential: Credential to use for SSH. (Generally should
235 be configured in defaults.yaml)
236 :mvn-settings: The name of settings file containing credentials for the project.
238 :Optional parameters:
240 :branch: The branch to build against. (default: master)
241 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
242 :build-timeout: Timeout in minutes before aborting build. (default: 60)
243 :deploy-path: The path in Nexus to deploy javadoc to. (default: $PROJECT/$STREAM)
244 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
245 :java-version: Version of Java to use for the build. (default: openjdk8)
246 :mvn-dir: Directory supplied as argument to -f option (default: '.')
247 :mvn-global-settings: The name of the Maven global settings to use for
248 Maven configuration. (default: global-settings)
249 :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
250 :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
251 Must not include a "-f" option; see parameter mvn-dir.
252 :mvn-version: Version of maven to use. (default: mvn35)
253 :stream: Keyword that can be used to represent a release code-name.
254 Often the same as the branch. (default: master)
255 :submodule-recursive: Whether to checkout submodules recursively.
257 :submodule-timeout: Timeout (in minutes) for checkout operation.
259 :submodule-disable: Disable submodule checkout operation.
262 :gerrit_verify_triggers: Override Gerrit Triggers.
267 Merge job which runs `mvn clean deploy` to build a project.
269 This job pushes files to Nexus using cURL instead of allowing the Maven deploy
270 goal to push the upload. This is to get around the issue that Maven deploy does
271 not properly support uploading files at the end of the build and instead pushes
272 as it goes. There exists a `-Ddeploy-at-end` feature however it does not work
275 This job uses the following strategy to deploy jobs to Nexus:
277 1. `wget -r` to fetch maven-metadata.xml from Nexus
278 2. `mvn deploy -DaltDeploymentRepository` to prepare files for upload
279 3. Removes untouched maven-metadata.xml files before upload
280 4. Use lftools (cURL) upload script to push artifacts to Nexus
284 - {project-name}-maven-merge-{stream}
288 :Comment Trigger: remerge
290 :Required parameters:
292 :build-node: The node to run build on.
293 :jenkins-ssh-credential: Credential to use for SSH. (Generally should
294 be configured in defaults.yaml)
295 :mvn-settings: The name of settings file containing credentials for the project.
296 :mvn-snapshot-id: Maven Server ID from settings.xml to pull credentials from.
297 (Note: This setting should be configured in defaults.yaml.)
298 :nexus-snapshot-repo: The repository id of the Nexus snapshot repo to deploy to.
300 :Optional parameters:
302 :branch: Git branch to fetch for the build. (default: master)
303 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
304 :build-timeout: Timeout in minutes before aborting build. (default: 60)
305 :cron: Cron schedule when to trigger the job. This parameter also
306 supports multiline input via YAML pipe | character in cases where
307 one may want to provide more than 1 cron timer. (default: 'H H * * 0'
309 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
310 :java-version: Version of Java to use for the build. (default: openjdk8)
311 :mvn-global-settings: The name of the Maven global settings to use for
312 Maven configuration. (default: global-settings)
313 :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
314 :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
315 :mvn-version: Version of maven to use. (default: mvn35)
316 :nexus-cut-dirs: Number of directories to cut from file path for `wget -r`.
317 :stream: Keyword that can be used to represent a release code-name.
318 Often the same as the branch. (default: master)
319 :submodule-recursive: Whether to checkout submodules recursively.
321 :submodule-timeout: Timeout (in minutes) for checkout operation.
323 :submodule-disable: Disable submodule checkout operation.
326 :gerrit_merge_triggers: Override Gerrit Triggers.
327 :gerrit_trigger_file_paths: Override file paths which can be used to
328 filter which file modifications will trigger a build.
330 Maven Merge for Docker
331 ----------------------
333 Produces a snapshot docker image in a Nexus registry. Appropriate for
334 Java projects that do not need to deploy any POM or JAR files.
336 Similar to Maven Merge as described above but logs in to Docker
337 registries first and skips the lf-maven-deploy builder. The project
338 POM file should invoke a plugin to build and push a Docker image. The
339 base image should be pulled from the registry in the environment
340 variable CONTAINER_PULL_REGISTRY. The new image should be pushed to the
341 registry in the environment variable CONTAINER_PUSH_REGISTRY.
345 - {project-name}-maven-docker-merge-{stream}
346 - gerrit-maven-docker-merge
347 - github-maven-docker-merge
349 :Required parameters:
351 :container-public-registry: Docker registry source with base images.
352 :container-snapshot-registry: Docker registry target for the deploy action.
354 All other required and optional parameters are identical to the Maven Merge job
360 Produces a release candidate by creating a staging repo in Nexus.
362 The staging repo name is in the format PROJECT-NUMBER for example "aaa-1234",
363 "autorelease-2000", "odlparent-1201", etc...
365 This job runs a Maven build and deploys to $WORKSPACE/m2repo directory. This
366 directory is then used later to deploy to Nexus.
370 - {project-name}-maven-stage-{stream}
374 :Comment Trigger: "stage-release" or "stage-maven-release"
376 :Required parameters:
378 :build-node: The node to run build on.
379 :jenkins-ssh-credential: Credential to use for SSH. (Generally should
380 be configured in defaults.yaml)
381 :mvn-settings: The name of settings file containing credentials for the project.
382 :mvn-staging-id: Maven Server ID from settings.xml to pull credentials from.
383 (Note: This setting should be configured in defaults.yaml.)
384 :staging-profile-id: Profile ID of the project's Nexus staging profile.
386 :Optional parameters:
388 :archive-artifacts: Artifacts to archive to the logs server (default: '').
389 :branch: The branch to build against. (default: master)
390 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
391 :build-timeout: Timeout in minutes before aborting build. (default: 60)
392 :cron: Cron schedule when to trigger the job. This parameter also
393 supports multiline input via YAML pipe | character in cases where
394 one may want to provide more than 1 cron timer. (default: '')
395 :deploy-path: The path in Nexus to deploy javadoc to. (default: $PROJECT/$STREAM)
396 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
397 :java-version: Version of Java to use for the build. (default: openjdk8)
398 :mvn-central: Set to 'true' to also stage to OSSRH. This is for projects
399 that want to release to Maven Central. If set the parameter
400 ``ossrh-profile-id`` also needs to be set. (default: false)
401 :maven-versions-plugin: Whether to call Maven versions plugin or not. (default: false)
402 :mvn-global-settings: The name of the Maven global settings to use for
403 Maven configuration. (default: global-settings)
404 :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
405 :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
406 :mvn-version: Version of maven to use. (default: mvn35)
407 :ossrh-profile-id: Profile ID for project as provided by OSSRH.
409 :sign-artifacts: Sign artifacts with Sigul. (default: false)
410 :stream: Keyword that can be used to represent a release code-name.
411 Often the same as the branch. (default: master)
412 :submodule-recursive: Whether to checkout submodules recursively.
414 :submodule-timeout: Timeout (in minutes) for checkout operation.
416 :submodule-disable: Disable submodule checkout operation.
418 :version-properties-file: Name and path of the version properties file.
419 (default: version.properties)
421 :gerrit_release_triggers: Override Gerrit Triggers.
422 :gerrit_trigger_file_paths: Override file paths which can be used to
423 filter which file modifications will trigger a build.
425 Maven Stage for Docker
426 ----------------------
428 Produces a release candidate docker image in a Nexus registry.
429 Appropriate for Java projects that do not need to deploy any POM or
432 Similar to Maven Stage as described above but logs in to Docker
433 registries first and skips the lf-maven-deploy builder. The project
434 POM file should invoke a plugin to build and push a Docker image. The
435 base image should be pulled from the registry in the environment
436 variable CONTAINER_PULL_REGISTRY. The new image should be pushed to the
437 registry in the environment variable CONTAINER_PUSH_REGISTRY.
441 - {project-name}-maven-docker-stage-{stream}
442 - gerrit-maven-docker-stage
443 - github-maven-docker-stage
445 :Comment Trigger: "stage-release" or "stage-docker-release"
447 :Required parameters:
449 :container-public-registry: Docker registry source with base images.
450 :container-staging-registry: Docker registry target for the deploy action.
452 :Optional parameters:
454 :gerrit_release_docker_triggers: Override Gerrit Triggers.
456 All other required and optional parameters are identical to the Maven Stage job
464 Sonar job which runs mvn clean install then publishes to Sonar.
466 This job purposely only runs on the master branch as there are Additional
467 configuration needed to support multiple branches and there's not much
468 interest in that kind of support.
472 - {project-name}-sonar
476 :Comment Trigger: run-sonar
478 :Required parameters:
480 :build-node: The node to run build on.
481 :jenkins-ssh-credential: Credential to use for SSH. (Generally should
482 be configured in defaults.yaml)
483 :mvn-settings: The name of settings file containing credentials for the project.
485 :Optional parameters:
487 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
488 :build-timeout: Timeout in minutes before aborting build. (default: 60)
489 :cron: Cron schedule when to trigger the job. This parameter also
490 supports multiline input via YAML pipe | character in cases where
491 one may want to provide more than 1 cron timer. (default: 'H H * * 6'
493 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
494 :java-version: Version of Java to use for the build. (default: openjdk8)
495 :mvn-global-settings: The name of the Maven global settings to use for
496 Maven configuration. (default: global-settings)
497 :mvn-goals: The maven goals to perform for the build.
498 (default: clean install)
499 :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
500 :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
501 :mvn-version: Version of maven to use. (default: mvn35)
502 :sonar-mvn-goals: Maven goals to run for sonar analysis.
503 (default: sonar:sonar)
504 :sonarcloud: Whether or not to use SonarCloud ``true|false``.
506 :sonarcloud-project-key: SonarCloud project key. (default: '')
507 :sonarcloud-project-organization: SonarCloud project organization.
509 :sonarcloud-api-token: SonarCloud API Token. (default: '')
510 :stream: Keyword that can be used to represent a release code-name.
511 Often the same as the branch. (default: master)
512 :submodule-recursive: Whether to checkout submodules recursively.
514 :submodule-timeout: Timeout (in minutes) for checkout operation.
516 :submodule-disable: Disable submodule checkout operation.
519 :gerrit_sonar_triggers: Override Gerrit Triggers.
524 .. literalinclude:: ../../.jjb-test/lf-maven-jobs/maven-sonarcloud.yaml
530 Verify job which runs mvn clean install to test a project build..
534 - {project-name}-maven-verify-{stream}-{mvn-version}-{java-version}
535 - gerrit-maven-verify
536 - github-maven-verify
538 :Comment Trigger: recheck|reverify
540 :Required parameters:
542 :build-node: The node to run build on.
543 :jenkins-ssh-credential: Credential to use for SSH. (Generally should
544 be configured in defaults.yaml)
545 :mvn-settings: The name of settings file containing credentials for the project.
547 :Optional parameters:
549 :branch: Git branch to fetch for the build. (default: master)
550 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
551 :build-timeout: Timeout in minutes before aborting build. (default: 60)
552 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
553 :java-version: Version of Java to use for the build. (default: openjdk8)
554 :mvn-global-settings: The name of the Maven global settings to use for
555 Maven configuration. (default: global-settings)
556 :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
557 :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
558 :mvn-version: Version of maven to use. (default: mvn35)
559 :stream: Keyword that can be used to represent a release code-name.
560 Often the same as the branch. (default: master)
561 :submodule-recursive: Whether to checkout submodules recursively.
563 :submodule-timeout: Timeout (in minutes) for checkout operation.
565 :submodule-disable: Disable submodule checkout operation.
568 :gerrit_verify_triggers: Override Gerrit Triggers.
569 :gerrit_trigger_file_paths: Override file paths which can be used to
570 filter which file modifications will trigger a build.
572 Maven Verify for Docker
573 -----------------------
575 Similar to Maven Verify as described above but logs in to Docker
576 registries first. The project POM file should invoke a plugin to build
577 a Docker image. The base image should be pulled from the registry in
578 the environment variable CONTAINER_PULL_REGISTRY.
582 - {project-name}-maven-docker-verify-{stream}-{mvn-version}-{java-version}
583 - gerrit-maven-docker-verify
584 - github-maven-docker-verify
586 :Required parameters:
588 :container-public-registry: Docker registry source with base images.
590 All other required and optional parameters are identical to the Maven Verify job
593 Maven Verify w/ Dependencies
594 ----------------------------
596 Verify job which runs mvn clean install to test a project build /w deps
598 This job can be used to verify a patch in conjunction to all of the
599 upstream patches it depends on. The user of this job can provide a list
604 - {project-name}-maven-verify-deps-{stream}-{mvn-version}-{java-version}
605 - gerrit-maven-verify-dependencies
607 :Comment Trigger: recheck: SPACE_SEPARATED_LIST_OF_PATCHES
609 :Required parameters:
611 :build-node: The node to run build on.
612 :jenkins-ssh-credential: Credential to use for SSH. (Generally should
613 be configured in defaults.yaml)
614 :mvn-settings: The name of settings file containing credentials for the project.
616 :Optional parameters:
618 :branch: Git branch to fetch for the build. (default: master)
619 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
620 :build-timeout: Timeout in minutes before aborting build. (default: 60)
621 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
622 :java-version: Version of Java to use for the build. (default: openjdk8)
623 :mvn-global-settings: The name of the Maven global settings to use for
624 Maven configuration. (default: global-settings)
625 :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
626 :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
627 :mvn-version: Version of maven to use. (default: mvn35)
628 :stream: Keyword that can be used to represent a release code-name.
629 Often the same as the branch. (default: master)
630 :submodule-recursive: Whether to checkout submodules recursively.
632 :submodule-timeout: Timeout (in minutes) for checkout operation.
634 :submodule-disable: Disable submodule checkout operation.
637 :gerrit_verify_triggers: Override Gerrit Triggers.
638 :gerrit_trigger_file_paths: Override file paths which can be used to
639 filter which file modifications will trigger a build.