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. (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
172 - {project-name}-maven-javadoc-publish-{stream}-{java-version}
173 - gerrit-maven-javadoc-publish
174 - github-maven-javadoc-publish
176 :Comment Trigger: remerge
178 :Required parameters:
180 :build-node: The node to run build on.
181 :javadoc-path: The path in Nexus to deploy javadoc to.
182 :jenkins-ssh-credential: Credential to use for SSH. (Generally should
183 be configured in defaults.yaml)
184 :mvn-settings: The name of settings file containing credentials for the project.
185 :mvn-site-id: Maven Server ID from settings.xml to pull credentials from.
186 (Note: This setting should be configured in defaults.yaml.)
188 :Optional parameters:
190 :branch: The branch to build against. (default: master)
191 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
192 :build-timeout: Timeout in minutes before aborting build. (default: 60)
193 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
194 :java-version: Version of Java to use for the build. (default: openjdk8)
195 :mvn-global-settings: The name of the Maven global settings to use for
196 Maven configuration. (default: global-settings)
197 :mvn-opts: Sets MAVEN_OPTS. (default: '')
198 :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
199 :mvn-version: Version of maven to use. (default: mvn35)
200 :stream: Keyword that can be used to represent a release code-name.
201 Often the same as the branch. (default: master)
202 :submodule-recursive: Whether to checkout submodules recursively.
204 :submodule-timeout: Timeout (in minutes) for checkout operation.
206 :submodule-disable: Disable submodule checkout operation.
209 :gerrit_merge_triggers: Override Gerrit Triggers.
214 Produces javadocs for a Maven project.
216 Expects javadocs to be available in $WORKSPACE/target/site/apidocs
220 - {project-name}-maven-javadoc-verify-{stream}-{java-version}
221 - gerrit-maven-javadoc-verify
222 - github-maven-javadoc-verify
224 :Comment Trigger: recheck|reverify
226 :Required parameters:
227 :build-node: The node to run build on.
228 :jenkins-ssh-credential: Credential to use for SSH. (Generally should
229 be configured in defaults.yaml)
230 :mvn-settings: The name of settings file containing credentials for the project.
232 :Optional parameters:
234 :branch: The branch to build against. (default: master)
235 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
236 :build-timeout: Timeout in minutes before aborting build. (default: 60)
237 :deploy-path: The path in Nexus to deploy javadoc to. (default: $PROJECT/$STREAM)
238 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
239 :java-version: Version of Java to use for the build. (default: openjdk8)
240 :mvn-global-settings: The name of the Maven global settings to use for
241 Maven configuration. (default: global-settings)
242 :mvn-opts: Sets MAVEN_OPTS. (default: '')
243 :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
244 :mvn-version: Version of maven to use. (default: mvn35)
245 :stream: Keyword that can be used to represent a release code-name.
246 Often the same as the branch. (default: master)
247 :submodule-recursive: Whether to checkout submodules recursively.
249 :submodule-timeout: Timeout (in minutes) for checkout operation.
251 :submodule-disable: Disable submodule checkout operation.
254 :gerrit_verify_triggers: Override Gerrit Triggers.
259 Merge job which runs `mvn clean deploy` to build a project.
261 This job pushes files to Nexus using cURL instead of allowing the Maven deploy
262 goal to push the upload. This is to get around the issue that Maven deploy does
263 not properly support uploading files at the end of the build and instead pushes
264 as it goes. There exists a `-Ddeploy-at-end` feature however it does not work
267 This job uses the following strategy to deploy jobs to Nexus:
269 1. `wget -r` to fetch maven-metadata.xml from Nexus
270 2. `mvn deploy -DaltDeploymentRepository` to prepare files for upload
271 3. Removes untouched maven-metadata.xml files before upload
272 4. Use lftools (cURL) upload script to push artifacts to Nexus
276 - {project-name}-maven-merge-{stream}
280 :Comment Trigger: remerge
282 :Required parameters:
284 :build-node: The node to run build on.
285 :jenkins-ssh-credential: Credential to use for SSH. (Generally should
286 be configured in defaults.yaml)
287 :mvn-settings: The name of settings file containing credentials for the project.
288 :mvn-snapshot-id: Maven Server ID from settings.xml to pull credentials from.
289 (Note: This setting should be configured in defaults.yaml.)
290 :nexus-snapshot-repo: The repository id of the Nexus snapshot repo to deploy to.
292 :Optional parameters:
294 :branch: Git branch to fetch for the build. (default: master)
295 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
296 :build-timeout: Timeout in minutes before aborting build. (default: 60)
297 :cron: Cron schedule when to trigger the job. This parameter also
298 supports multiline input via YAML pipe | character in cases where
299 one may want to provide more than 1 cron timer. (default: 'H H * * 0'
301 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
302 :java-version: Version of Java to use for the build. (default: openjdk8)
303 :mvn-global-settings: The name of the Maven global settings to use for
304 Maven configuration. (default: global-settings)
305 :mvn-opts: Sets MAVEN_OPTS. (default: '')
306 :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
307 :mvn-version: Version of maven to use. (default: mvn35)
308 :nexus-cut-dirs: Number of directories to cut from file path for `wget -r`.
309 :stream: Keyword that can be used to represent a release code-name.
310 Often the same as the branch. (default: master)
311 :submodule-recursive: Whether to checkout submodules recursively.
313 :submodule-timeout: Timeout (in minutes) for checkout operation.
315 :submodule-disable: Disable submodule checkout operation.
318 :gerrit_merge_triggers: Override Gerrit Triggers.
319 :gerrit_trigger_file_paths: Override file paths which can be used to
320 filter which file modifications will trigger a build.
322 Maven Merge for Docker
323 ----------------------
325 Produces a snapshot docker image in a Nexus registry. Appropriate for
326 Java projects that do not need to deploy any POM or JAR files.
328 Similar to Maven Merge as described above but logs in to Docker
329 registries first and skips the lf-maven-deploy builder. The project
330 POM file should invoke a plugin to build and push a Docker image. The
331 base image should be pulled from the registry in the environment
332 variable CONTAINER_PULL_REGISTRY. The new image should be pushed to the
333 registry in the environment variable CONTAINER_PUSH_REGISTRY.
337 - {project-name}-maven-docker-merge-{stream}
338 - gerrit-maven-docker-merge
339 - github-maven-docker-merge
341 :Required parameters:
343 :container-public-registry: Docker registry source with base images.
344 :container-snapshot-registry: Docker registry target for the deploy action.
346 All other required and optional parameters are identical to the Maven Merge job
352 Produces a release candidate by creating a staging repo in Nexus.
354 The staging repo name is in the format PROJECT-NUMBER for example "aaa-1234",
355 "autorelease-2000", "odlparent-1201", etc...
357 This job runs a Maven build and deploys to $WORKSPACE/m2repo directory. This
358 directory is then used later to deploy to Nexus.
362 - {project-name}-maven-stage-{stream}
366 :Comment Trigger: "stage-release" or "stage-maven-release"
368 :Required parameters:
370 :build-node: The node to run build on.
371 :jenkins-ssh-credential: Credential to use for SSH. (Generally should
372 be configured in defaults.yaml)
373 :mvn-settings: The name of settings file containing credentials for the project.
374 :mvn-staging-id: Maven Server ID from settings.xml to pull credentials from.
375 (Note: This setting should be configured in defaults.yaml.)
376 :staging-profile-id: Profile ID of the project's Nexus staging profile.
378 :Optional parameters:
380 :archive-artifacts: Artifacts to archive to the logs server (default: '').
381 :branch: The branch to build against. (default: master)
382 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
383 :build-timeout: Timeout in minutes before aborting build. (default: 60)
384 :cron: Cron schedule when to trigger the job. This parameter also
385 supports multiline input via YAML pipe | character in cases where
386 one may want to provide more than 1 cron timer. (default: '')
387 :deploy-path: The path in Nexus to deploy javadoc to. (default: $PROJECT/$STREAM)
388 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
389 :java-version: Version of Java to use for the build. (default: openjdk8)
390 :mvn-central: Set to 'true' to also stage to OSSRH. This is for projects
391 that want to release to Maven Central. If set the parameter
392 ``ossrh-profile-id`` also needs to be set. (default: false)
393 :maven-versions-plugin: Whether to call Maven versions plugin or not. (default: false)
394 :mvn-global-settings: The name of the Maven global settings to use for
395 Maven configuration. (default: global-settings)
396 :mvn-opts: Sets MAVEN_OPTS. (default: '')
397 :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
398 :mvn-version: Version of maven to use. (default: mvn35)
399 :ossrh-profile-id: Profile ID for project as provided by OSSRH.
401 :sign-artifacts: Sign artifacts with Sigul. (default: false)
402 :stream: Keyword that can be used to represent a release code-name.
403 Often the same as the branch. (default: master)
404 :submodule-recursive: Whether to checkout submodules recursively.
406 :submodule-timeout: Timeout (in minutes) for checkout operation.
408 :submodule-disable: Disable submodule checkout operation.
410 :version-properties-file: Name and path of the version properties file.
411 (default: version.properties)
413 :gerrit_release_triggers: Override Gerrit Triggers.
414 :gerrit_trigger_file_paths: Override file paths which can be used to
415 filter which file modifications will trigger a build.
417 Maven Stage for Docker
418 ----------------------
420 Produces a release candidate docker image in a Nexus registry.
421 Appropriate for Java projects that do not need to deploy any POM or
424 Similar to Maven Stage as described above but logs in to Docker
425 registries first and skips the lf-maven-deploy builder. The project
426 POM file should invoke a plugin to build and push a Docker image. The
427 base image should be pulled from the registry in the environment
428 variable CONTAINER_PULL_REGISTRY. The new image should be pushed to the
429 registry in the environment variable CONTAINER_PUSH_REGISTRY.
433 - {project-name}-maven-docker-stage-{stream}
434 - gerrit-maven-docker-stage
435 - github-maven-docker-stage
437 :Comment Trigger: "stage-release" or "stage-docker-release"
439 :Required parameters:
441 :container-public-registry: Docker registry source with base images.
442 :container-staging-registry: Docker registry target for the deploy action.
444 :Optional parameters:
446 :gerrit_release_docker_triggers: Override Gerrit Triggers.
448 All other required and optional parameters are identical to the Maven Stage job
456 Sonar job which runs mvn clean install then publishes to Sonar.
458 This job purposely only runs on the master branch as there are Additional
459 configuration needed to support multiple branches and there's not much
460 interest in that kind of support.
464 - {project-name}-sonar
468 :Comment Trigger: run-sonar
470 :Required parameters:
472 :build-node: The node to run build on.
473 :jenkins-ssh-credential: Credential to use for SSH. (Generally should
474 be configured in defaults.yaml)
475 :mvn-settings: The name of settings file containing credentials for the project.
477 :Optional parameters:
479 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
480 :build-timeout: Timeout in minutes before aborting build. (default: 60)
481 :cron: Cron schedule when to trigger the job. This parameter also
482 supports multiline input via YAML pipe | character in cases where
483 one may want to provide more than 1 cron timer. (default: 'H H * * 6'
485 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
486 :java-version: Version of Java to use for the build. (default: openjdk8)
487 :mvn-global-settings: The name of the Maven global settings to use for
488 Maven configuration. (default: global-settings)
489 :mvn-goals: The maven goals to perform for the build.
490 (default: clean install)
491 :mvn-opts: Sets MAVEN_OPTS. (default: '')
492 :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
493 :mvn-version: Version of maven to use. (default: mvn35)
494 :sonar-mvn-goals: Maven goals to run for sonar analysis.
495 (default: sonar:sonar)
496 :sonarcloud: Whether or not to use SonarCloud ``true|false``.
498 :sonarcloud-project-key: SonarCloud project key. (default: '')
499 :sonarcloud-project-organization: SonarCloud project organization.
501 :sonarcloud-api-token: SonarCloud API Token. (default: '')
502 :stream: Keyword that can be used to represent a release code-name.
503 Often the same as the branch. (default: master)
504 :submodule-recursive: Whether to checkout submodules recursively.
506 :submodule-timeout: Timeout (in minutes) for checkout operation.
508 :submodule-disable: Disable submodule checkout operation.
511 :gerrit_sonar_triggers: Override Gerrit Triggers.
516 .. literalinclude:: ../../.jjb-test/lf-maven-jobs/maven-sonarcloud.yaml
522 Verify job which runs mvn clean install to test a project build..
526 - {project-name}-maven-verify-{stream}-{mvn-version}-{java-version}
527 - gerrit-maven-verify
528 - github-maven-verify
530 :Comment Trigger: recheck|reverify
532 :Required parameters:
534 :build-node: The node to run build on.
535 :jenkins-ssh-credential: Credential to use for SSH. (Generally should
536 be configured in defaults.yaml)
537 :mvn-settings: The name of settings file containing credentials for the project.
539 :Optional parameters:
541 :branch: Git branch to fetch for the build. (default: master)
542 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
543 :build-timeout: Timeout in minutes before aborting build. (default: 60)
544 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
545 :java-version: Version of Java to use for the build. (default: openjdk8)
546 :mvn-global-settings: The name of the Maven global settings to use for
547 Maven configuration. (default: global-settings)
548 :mvn-opts: Sets MAVEN_OPTS. (default: '')
549 :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
550 :mvn-version: Version of maven to use. (default: mvn35)
551 :stream: Keyword that can be used to represent a release code-name.
552 Often the same as the branch. (default: master)
553 :submodule-recursive: Whether to checkout submodules recursively.
555 :submodule-timeout: Timeout (in minutes) for checkout operation.
557 :submodule-disable: Disable submodule checkout operation.
560 :gerrit_verify_triggers: Override Gerrit Triggers.
561 :gerrit_trigger_file_paths: Override file paths which can be used to
562 filter which file modifications will trigger a build.
564 Maven Verify for Docker
565 -----------------------
567 Similar to Maven Verify as described above but logs in to Docker
568 registries first. The project POM file should invoke a plugin to build
569 a Docker image. The base image should be pulled from the registry in
570 the environment variable CONTAINER_PULL_REGISTRY.
574 - {project-name}-maven-docker-verify-{stream}-{mvn-version}-{java-version}
575 - gerrit-maven-docker-verify
576 - github-maven-docker-verify
578 :Required parameters:
580 :container-public-registry: Docker registry source with base images.
582 All other required and optional parameters are identical to the Maven Verify job
585 Maven Verify w/ Dependencies
586 ----------------------------
588 Verify job which runs mvn clean install to test a project build /w deps
590 This job can be used to verify a patch in conjunction to all of the
591 upstream patches it depends on. The user of this job can provide a list
596 - {project-name}-maven-verify-deps-{stream}-{mvn-version}-{java-version}
597 - gerrit-maven-verify-dependencies
599 :Comment Trigger: recheck: SPACE_SEPARATED_LIST_OF_PATCHES
601 :Required parameters:
603 :build-node: The node to run build on.
604 :jenkins-ssh-credential: Credential to use for SSH. (Generally should
605 be configured in defaults.yaml)
606 :mvn-settings: The name of settings file containing credentials for the project.
608 :Optional parameters:
610 :branch: Git branch to fetch for the build. (default: master)
611 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
612 :build-timeout: Timeout in minutes before aborting build. (default: 60)
613 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
614 :java-version: Version of Java to use for the build. (default: openjdk8)
615 :mvn-global-settings: The name of the Maven global settings to use for
616 Maven configuration. (default: global-settings)
617 :mvn-opts: Sets MAVEN_OPTS. (default: '')
618 :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
619 :mvn-version: Version of maven to use. (default: mvn35)
620 :stream: Keyword that can be used to represent a release code-name.
621 Often the same as the branch. (default: master)
622 :submodule-recursive: Whether to checkout submodules recursively.
624 :submodule-timeout: Timeout (in minutes) for checkout operation.
626 :submodule-disable: Disable submodule checkout operation.
629 :gerrit_verify_triggers: Override Gerrit Triggers.
630 :gerrit_trigger_file_paths: Override file paths which can be used to
631 filter which file modifications will trigger a build.