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 configured in defaults.yaml)
129 :mvn-settings: The name of settings file containing credentials for the project.
131 :Optional parameters:
133 :branch: The branch to build against. (default: master)
134 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
135 :build-timeout: Timeout in minutes before aborting build. (default: 60)
136 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
137 :java-version: Version of Java to use for the build. (default: openjdk8)
138 :mvn-global-settings: The name of the Maven global settings to use for
139 Maven configuration. (default: global-settings)
140 :mvn-goals: The maven goals to perform for the build.
141 (default: clean install)
142 :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
143 :mvn-params: Parameters to pass to the mvn CLI. (default: '')
144 :mvn-version: Version of maven to use. (default: mvn35)
145 :nexus-iq-namespace: Insert a namespace to project AppID for projects that
146 share a Nexus IQ system to avoid project name collision. We recommend
147 inserting a trailing - dash if using this parameter.
148 For example 'odl-'. (default: '')
149 :nexus-iq-stage: Sets the **stage** which the policy evaluation will run
150 against on the Nexus IQ Server. (default: 'build')
151 :stream: Keyword that represents a release code-name.
152 Often the same as the branch. (default: master)
153 :submodule-recursive: Whether to checkout submodules recursively.
155 :submodule-timeout: Timeout (in minutes) for checkout operation.
157 :submodule-disable: Disable submodule checkout operation.
160 :gerrit_merge_triggers: Override Gerrit Triggers.
162 Maven JavaDoc Publish
163 ---------------------
165 Produces and publishes javadocs for a Maven project.
167 Expects javadocs to be available in ``$WORKSPACE/target/site/apidocs``, but
168 overrideable with the ``mvn-dir`` parameter. If set, will search for javadocs
169 in ``$WORKSPACE/{mvn-dir}/target/site/apidocs``.
173 - {project-name}-maven-javadoc-publish-{stream}-{java-version}
174 - gerrit-maven-javadoc-publish
175 - github-maven-javadoc-publish
177 :Comment Trigger: remerge
179 :Required parameters:
181 :build-node: The node to run build on.
182 :javadoc-path: The path in Nexus to deploy javadoc to.
183 :jenkins-ssh-credential: Credential to use for SSH. (Generally 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 is generally 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-dir: Directory supplied as argument to -f option (default: '.')
196 :mvn-global-settings: The name of the Maven global settings to use for
197 Maven configuration. (default: global-settings)
198 :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
199 :mvn-params: Parameters to pass to the mvn CLI. (default: '')
200 Must not include a "-f" option; see parameter mvn-dir.
201 :mvn-version: Version of maven to use. (default: mvn35)
202 :stream: Keyword that represents a release code-name.
203 Often the same as the branch. (default: master)
204 :submodule-recursive: Whether to checkout submodules recursively.
206 :submodule-timeout: Timeout (in minutes) for checkout operation.
208 :submodule-disable: Disable submodule checkout operation.
211 :gerrit_merge_triggers: Override Gerrit Triggers.
216 Produces javadocs for a Maven project.
218 Expects javadocs to be available in ``$WORKSPACE/target/site/apidocs``, but
219 overrideable with the ``mvn-dir`` parameter. If set, will search for javadocs
220 in ``$WORKSPACE/{mvn-dir}/target/site/apidocs``.
224 - {project-name}-maven-javadoc-verify-{stream}-{java-version}
225 - gerrit-maven-javadoc-verify
226 - github-maven-javadoc-verify
228 :Comment Trigger: recheck|reverify
230 :Required parameters:
231 :build-node: The node to run build on.
232 :jenkins-ssh-credential: Credential to use for SSH. (Generally configured in defaults.yaml)
233 :mvn-settings: The name of settings file containing credentials for the project.
235 :Optional parameters:
237 :branch: The branch to build against. (default: master)
238 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
239 :build-timeout: Timeout in minutes before aborting build. (default: 60)
240 :deploy-path: The path in Nexus to deploy javadoc to. (default: $PROJECT/$STREAM)
241 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
242 :java-version: Version of Java to use for the build. (default: openjdk8)
243 :mvn-dir: Directory supplied as argument to -f option (default: '.')
244 :mvn-global-settings: The name of the Maven global settings to use for
245 Maven configuration. (default: global-settings)
246 :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
247 :mvn-params: Parameters to pass to the mvn CLI. (default: '')
248 Must not include a "-f" option; see parameter mvn-dir.
249 :mvn-version: Version of maven to use. (default: mvn35)
250 :stream: Keyword that represents a release code-name.
251 Often the same as the branch. (default: master)
252 :submodule-recursive: Whether to checkout submodules recursively.
254 :submodule-timeout: Timeout (in minutes) for checkout operation.
256 :submodule-disable: Disable submodule checkout operation.
259 :gerrit_verify_triggers: Override Gerrit Triggers.
264 Merge job which runs `mvn clean deploy` to build a project.
266 This job pushes files to Nexus using cURL instead of allowing the Maven deploy
267 goal to push the upload. This is to get around the issue that Maven deploy does
268 not properly support uploading files at the end of the build and instead pushes
269 as it goes. There exists a ``-Ddeploy-at-end`` feature but it does not work
272 This job uses the following strategy to deploy jobs to Nexus:
274 1. ``wget -r`` to fetch maven-metadata.xml from Nexus
275 2. ``mvn deploy -DaltDeploymentRepository`` to prepare files for upload
276 3. Removes untouched maven-metadata.xml files before upload
277 4. Use lftools (cURL) upload script to push artifacts to Nexus
281 - {project-name}-maven-merge-{stream}
285 :Comment Trigger: remerge
287 :Required parameters:
289 :build-node: The node to run build on.
290 :jenkins-ssh-credential: Credential to use for SSH. (Generally configured in defaults.yaml)
291 :mvn-settings: The name of settings file containing credentials for the project.
292 :mvn-snapshot-id: Maven Server ID from settings.xml to pull credentials from.
293 (Note: This setting is generally configured in ``defaults.yaml``.)
294 :nexus-snapshot-repo: The repository id of the Nexus snapshot repo to deploy to.
296 :Optional parameters:
298 :branch: Git branch to fetch for the build. (default: master)
299 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
300 :build-timeout: Timeout in minutes before aborting build. (default: 60)
301 :cron: Cron schedule when to trigger the job. This parameter also
302 supports multiline input via YAML pipe | character in cases where
303 one may want to provide more than 1 cron timer. (default: 'H H * * 0'
305 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
306 :java-version: Version of Java to use for the build. (default: openjdk8)
307 :mvn-global-settings: The name of the Maven global settings to use for
308 Maven configuration. (default: global-settings)
309 :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
310 :mvn-params: Parameters to pass to the mvn CLI. (default: '')
311 :mvn-version: Version of maven to use. (default: mvn35)
312 :nexus-cut-dirs: Number of directories to cut from file path for `wget -r`.
313 :stream: Keyword that represents a release code-name.
314 Often the same as the branch. (default: master)
315 :submodule-recursive: Whether to checkout submodules recursively.
317 :submodule-timeout: Timeout (in minutes) for checkout operation.
319 :submodule-disable: Disable submodule checkout operation.
322 :gerrit_merge_triggers: Override Gerrit Triggers.
323 :gerrit_trigger_file_paths: Override file paths to filter which file
324 modifications will trigger a build.
326 Maven Merge for Docker
327 ----------------------
329 Produces a snapshot docker image in a Nexus registry. Appropriate for
330 Java projects that do not need to deploy any POM or JAR files.
332 Like the Maven Merge job as described above but logs in to Docker
333 registries first and skips the lf-maven-deploy builder. The project
334 POM file should invoke a plugin to build and push a Docker image.
335 This pulls the base image from the registry in the environment
336 variable ``CONTAINER_PULL_REGISTRY`` and pushes new image into the
337 registry in the environment variable ``CONTAINER_PUSH_REGISTRY``.
341 - {project-name}-maven-docker-merge-{stream}
342 - gerrit-maven-docker-merge
343 - github-maven-docker-merge
345 :Required parameters:
347 :container-public-registry: Docker registry source with base images.
348 :container-snapshot-registry: Docker registry target for the deploy action.
350 All other required and optional parameters are identical to the Maven Merge job
356 Produces a release candidate by creating a staging repo in Nexus.
358 The staging repo name is in the format PROJECT-NUMBER for example "aaa-1234",
359 "autorelease-2000", "odlparent-1201", etc...
361 This job runs a Maven build and deploys to $WORKSPACE/m2repo directory. This
362 directory is then used later to deploy to Nexus.
366 - {project-name}-maven-stage-{stream}
370 :Comment Trigger: "stage-release" or "stage-maven-release"
372 :Required parameters:
374 :build-node: The node to run build on.
375 :jenkins-ssh-credential: Credential to use for SSH. (Generally configured in defaults.yaml)
376 :mvn-settings: The name of settings file containing credentials for the project.
377 :mvn-staging-id: Maven Server ID from settings.xml to pull credentials from.
378 (Note: This setting is generally configured in ``defaults.yaml``.)
379 :staging-profile-id: Profile ID of the project's Nexus staging profile.
381 :Optional parameters:
383 :archive-artifacts: Artifacts to archive to the logs server (default: '').
384 :branch: The branch to build against. (default: master)
385 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
386 :build-timeout: Timeout in minutes before aborting build. (default: 60)
387 :cron: Cron schedule when to trigger the job. This parameter also
388 supports multiline input via YAML pipe | character in cases where
389 one may want to provide more than 1 cron timer. (default: '')
390 :deploy-path: The path in Nexus to deploy javadoc to. (default: $PROJECT/$STREAM)
391 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
392 :java-version: Version of Java to use for the build. (default: openjdk8)
393 :mvn-central: Set to ``true`` to also stage to **OSSRH**. This is for projects
394 that want to release to Maven Central. If set, then also set the parameter
395 ``ossrh-profile-id``. (default: false)
396 :maven-versions-plugin: Whether to call Maven versions plugin or not. (default: false)
397 :mvn-global-settings: The name of the Maven global settings to use for
398 Maven configuration. (default: global-settings)
399 :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
400 :mvn-params: Parameters to pass to the mvn CLI. (default: '')
401 :mvn-version: Version of maven to use. (default: mvn35)
402 :ossrh-profile-id: Profile ID for project as provided by OSSRH.
404 :sign-artifacts: Sign artifacts with Sigul. (default: false)
405 :stream: Keyword that represents a release code-name.
406 Often the same as the branch. (default: master)
407 :submodule-recursive: Whether to checkout submodules recursively.
409 :submodule-timeout: Timeout (in minutes) for checkout operation.
411 :submodule-disable: Disable submodule checkout operation.
413 :version-properties-file: Name and path of the version properties file.
414 (default: version.properties)
416 :gerrit_release_triggers: Override Gerrit Triggers.
417 :gerrit_trigger_file_paths: Override file paths to filter which file
418 modifications will trigger a build.
420 Maven Stage for Docker
421 ----------------------
423 Produces a release candidate docker image in a Nexus registry.
424 Appropriate for Java projects that do not need to deploy any POM or
427 Like the Maven Stage job as described above but logs in to Docker
428 registries first and skips the lf-maven-deploy builder. The project
429 POM file should invoke a plugin to build and push a Docker image.
430 This pulls the base image from the registry in the environment
431 variable ``CONTAINER_PULL_REGISTRY`` and pushes new image into the
432 registry in the environment variable ``CONTAINER_PUSH_REGISTRY``.
436 - {project-name}-maven-docker-stage-{stream}
437 - gerrit-maven-docker-stage
438 - github-maven-docker-stage
440 :Comment Trigger: "stage-release" or "stage-docker-release"
442 :Required parameters:
444 :container-public-registry: Docker registry source with base images.
445 :container-staging-registry: Docker registry target for the deploy action.
447 :Optional parameters:
449 :gerrit_release_docker_triggers: Override Gerrit Triggers.
451 All other required and optional parameters are identical to the Maven Stage job
459 Sonar job which runs mvn clean install then publishes to Sonar.
461 This job purposely runs on the ``master`` branch and does not support
462 multi-branch configuration.
466 - {project-name}-sonar
470 :Comment Trigger: run-sonar
472 :Required parameters:
474 :build-node: The node to run build on.
475 :jenkins-ssh-credential: Credential to use for SSH. (Generally configured in defaults.yaml)
476 :mvn-settings: The name of settings file containing credentials for the project.
478 :Optional parameters:
480 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
481 :build-timeout: Timeout in minutes before aborting build. (default: 60)
482 :cron: Cron schedule when to trigger the job. This parameter also
483 supports multiline input via YAML pipe | character in cases where
484 one may want to provide more than 1 cron timer. (default: 'H H * * 6'
486 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
487 :java-version: Version of Java to use for the build. (default: openjdk8)
488 :mvn-global-settings: The name of the Maven global settings to use for
489 Maven configuration. (default: global-settings)
490 :mvn-goals: The maven goals to perform for the build.
491 (default: clean install)
492 :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
493 :mvn-params: Parameters to pass to the mvn CLI. (default: '')
494 :mvn-version: Version of maven to use. (default: mvn35)
495 :sonar-mvn-goals: Maven goals to run for sonar analysis.
496 (default: sonar:sonar)
497 :sonarcloud: Set to ``true`` to use SonarCloud ``true|false``.
499 :sonarcloud-project-key: SonarCloud project key. (default: '')
500 :sonarcloud-project-organization: SonarCloud project organization.
502 :sonarcloud-api-token: SonarCloud API Token. (default: '')
503 :stream: Keyword that represents a release code-name.
504 Often the same as the branch. (default: master)
505 :submodule-recursive: Whether to checkout submodules recursively.
507 :submodule-timeout: Timeout (in minutes) for checkout operation.
509 :submodule-disable: Disable submodule checkout operation.
512 :gerrit_sonar_triggers: Override Gerrit Triggers.
517 .. literalinclude:: ../../.jjb-test/lf-maven-jobs/maven-sonarcloud.yaml
523 Verify job which runs mvn clean install to test a project build..
527 - {project-name}-maven-verify-{stream}-{mvn-version}-{java-version}
528 - gerrit-maven-verify
529 - github-maven-verify
531 :Comment Trigger: recheck|reverify
533 :Required parameters:
535 :build-node: The node to run build on.
536 :jenkins-ssh-credential: Credential to use for SSH. (Generally 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 to start up the JVM running Maven. (default: '')
549 :mvn-params: Parameters to pass to the mvn CLI. (default: '')
550 :mvn-version: Version of maven to use. (default: mvn35)
551 :stream: Keyword that represents 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 to filter which file
562 modifications will trigger a build.
564 Maven Verify for Docker
565 -----------------------
567 Like the Maven Verify job 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. This pulls the base image from the registry in the environment
570 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's purpose is to verify a patch in conjunction to a list of upstream
591 patches it depends on. The user of this job can provide a list of patches via
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 configured in defaults.yaml)
605 :mvn-settings: The name of settings file containing credentials for the project.
607 :Optional parameters:
609 :branch: Git branch to fetch for the build. (default: master)
610 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
611 :build-timeout: Timeout in minutes before aborting build. (default: 60)
612 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
613 :java-version: Version of Java to use for the build. (default: openjdk8)
614 :mvn-global-settings: The name of the Maven global settings to use for
615 Maven configuration. (default: global-settings)
616 :mvn-opts: Sets MAVEN_OPTS to start up the JVM running Maven. (default: '')
617 :mvn-params: Parameters to pass to the mvn CLI. (default: '')
618 :mvn-version: Version of maven to use. (default: mvn35)
619 :stream: Keyword that represents a release code-name.
620 Often the same as the branch. (default: master)
621 :submodule-recursive: Whether to checkout submodules recursively.
623 :submodule-timeout: Timeout (in minutes) for checkout operation.
625 :submodule-disable: Disable submodule checkout operation.
628 :gerrit_verify_triggers: Override Gerrit Triggers.
629 :gerrit_trigger_file_paths: Override file paths to filter which file
630 modifications will trigger a build.