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 :mvn-version: Version of Maven to execute Sonar with.
73 :mvn-pom: Location of pom.xml.
74 :mvn-settings: Maven settings.xml file containing credentials to use.
79 Calls the maven stage script to push artifacts to a Nexus staging repository.
83 :mvn-global-settings: The name of the Maven global settings to use for
85 :mvn-settings: The name of settings file containing credentials for the project.
87 lf-update-java-alternatives
88 ---------------------------
90 Setup Java alternatives for the Distro.
94 :java-version: Version of Java to set as the default Java.
103 Produces a CLM scan of the code into Nexus IQ Server.
107 - {project-name}-maven-clm-{stream}
111 :Comment Trigger: run-clm
113 :Required parameters:
115 :build-node: The node to run build on.
116 :jenkins-ssh-credential: Credential to use for SSH. (Generally should
117 be configured in defaults.yaml)
118 :mvn-settings: The name of settings file containing credentials for the project.
120 :Optional parameters:
122 :branch: The branch to build against. (default: master)
123 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
124 :build-timeout: Timeout in minutes before aborting build. (default: 60)
125 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
126 :java-version: Version of Java to use for the build. (default: openjdk8)
127 :mvn-global-settings: The name of the Maven global settings to use for
128 Maven configuration. (default: global-settings)
129 :mvn-opts: Sets MAVEN_OPTS. (default: '')
130 :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
131 :mvn-version: Version of maven to use. (default: mvn35)
132 :nexus-iq-namespace: Insert a namespace to project AppID for projects that
133 share a Nexus IQ system to avoid project name collision. We recommend
134 inserting a trailing - dash if using this parameter.
135 For example 'odl-'. (default: '')
136 :nexus-iq-stage: Stage the policy evaluation will be run against on
137 the Nexus IQ Server. (default: 'build')
138 :stream: Keyword that can be used to represent a release code-name.
139 Often the same as the branch. (default: master)
140 :submodule-recursive: Whether to checkout submodules recursively.
142 :submodule-timeout: Timeout (in minutes) for checkout operation.
145 :gerrit_merge_triggers: Override Gerrit Triggers.
147 Maven JavaDoc Publish
148 ---------------------
150 Produces and publishes javadocs for a Maven project.
152 Expects javadocs to be available in $WORKSPACE/target/site/apidocs
156 - {project-name}-maven-javadoc-publish-{stream}-{java-version}
157 - gerrit-maven-javadoc-publish
158 - github-maven-javadoc-publish
160 :Comment Trigger: remerge
162 :Required parameters:
164 :build-node: The node to run build on.
165 :javadoc-path: The path in Nexus to deploy javadoc to.
166 :jenkins-ssh-credential: Credential to use for SSH. (Generally should
167 be configured in defaults.yaml)
168 :mvn-settings: The name of settings file containing credentials for the project.
169 :mvn-site-id: Maven Server ID from settings.xml to pull credentials from.
170 (Note: This setting should be configured in defaults.yaml.)
172 :Optional parameters:
174 :branch: The branch to build against. (default: master)
175 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
176 :build-timeout: Timeout in minutes before aborting build. (default: 60)
177 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
178 :java-version: Version of Java to use for the build. (default: openjdk8)
179 :mvn-global-settings: The name of the Maven global settings to use for
180 Maven configuration. (default: global-settings)
181 :mvn-opts: Sets MAVEN_OPTS. (default: '')
182 :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
183 :mvn-version: Version of maven to use. (default: mvn35)
184 :stream: Keyword that can be used to represent a release code-name.
185 Often the same as the branch. (default: master)
186 :submodule-recursive: Whether to checkout submodules recursively.
188 :submodule-timeout: Timeout (in minutes) for checkout operation.
191 :gerrit_merge_triggers: Override Gerrit Triggers.
196 Produces javadocs for a Maven project.
198 Expects javadocs to be available in $WORKSPACE/target/site/apidocs
202 - {project-name}-maven-javadoc-verify-{stream}-{java-version}
203 - gerrit-maven-javadoc-verify
204 - github-maven-javadoc-verify
206 :Comment Trigger: recheck|reverify
208 :Required parameters:
209 :build-node: The node to run build on.
210 :jenkins-ssh-credential: Credential to use for SSH. (Generally should
211 be configured in defaults.yaml)
212 :mvn-settings: The name of settings file containing credentials for the project.
214 :Optional parameters:
216 :branch: The branch to build against. (default: master)
217 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
218 :build-timeout: Timeout in minutes before aborting build. (default: 60)
219 :deploy-path: The path in Nexus to deploy javadoc to. (default: $PROJECT/$STREAM)
220 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
221 :java-version: Version of Java to use for the build. (default: openjdk8)
222 :mvn-global-settings: The name of the Maven global settings to use for
223 Maven configuration. (default: global-settings)
224 :mvn-opts: Sets MAVEN_OPTS. (default: '')
225 :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
226 :mvn-version: Version of maven to use. (default: mvn35)
227 :stream: Keyword that can be used to represent a release code-name.
228 Often the same as the branch. (default: master)
229 :submodule-recursive: Whether to checkout submodules recursively.
231 :submodule-timeout: Timeout (in minutes) for checkout operation.
234 :gerrit_verify_triggers: Override Gerrit Triggers.
239 Merge job which runs `mvn clean deploy` to build a project.
241 This job pushes files to Nexus using cURL instead of allowing the Maven deploy
242 goal to push the upload. This is to get around the issue that Maven deploy does
243 not properly support uploading files at the end of the build and instead pushes
244 as it goes. There exists a `-Ddeploy-at-end` feature however it does not work
247 This job uses the following strategy to deploy jobs to Nexus:
249 1. `wget -r` to fetch maven-metadata.xml from Nexus
250 2. `mvn deploy -DaltDeploymentRepository` to prepare files for upload
251 3. Removes untouched maven-metadata.xml files before upload
252 4. Use lftools (cURL) upload script to push artifacts to Nexus
256 - {project-name}-maven-merge-{stream}
260 :Comment Trigger: remerge
262 :Required parameters:
264 :build-node: The node to run build on.
265 :jenkins-ssh-credential: Credential to use for SSH. (Generally should
266 be configured in defaults.yaml)
267 :mvn-settings: The name of settings file containing credentials for the project.
268 :mvn-snapshot-id: Maven Server ID from settings.xml to pull credentials from.
269 (Note: This setting should be configured in defaults.yaml.)
270 :nexus-snapshot-repo: The repository id of the Nexus snapshot repo to deploy to.
272 :Optional parameters:
274 :branch: Git branch to fetch for the build. (default: master)
275 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
276 :build-timeout: Timeout in minutes before aborting build. (default: 60)
277 :cron: Cron schedule when to trigger the job. This parameter also
278 supports multiline input via YAML pipe | character in cases where
279 one may want to provide more than 1 cron timer. (default: 'H H * * 0'
281 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
282 :java-version: Version of Java to use for the build. (default: openjdk8)
283 :mvn-global-settings: The name of the Maven global settings to use for
284 Maven configuration. (default: global-settings)
285 :mvn-opts: Sets MAVEN_OPTS. (default: '')
286 :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
287 :mvn-version: Version of maven to use. (default: mvn35)
288 :nexus-cut-dirs: Number of directories to cut from file path for `wget -r`.
289 :stream: Keyword that can be used to represent a release code-name.
290 Often the same as the branch. (default: master)
291 :submodule-recursive: Whether to checkout submodules recursively.
293 :submodule-timeout: Timeout (in minutes) for checkout operation.
295 :gerrit_merge_triggers: Override Gerrit Triggers.
296 :gerrit_trigger_file_paths: Override file paths which can be used to
297 filter which file modifications will trigger a build.
299 Maven Merge for Docker
300 ----------------------
302 Produces a snapshot docker image in a Nexus registry. Appropriate for
303 Java projects that do not need to deploy any POM or JAR files.
305 Similar to Maven Merge as described above but logs in to Docker
306 registries first and skips the lf-maven-deploy builder. The project
307 POM file should invoke a plugin to build and push a Docker image. The
308 base image should be pulled from the registry in the environment
309 variable CONTAINER_PULL_REGISTRY. The new image should be pushed to the
310 registry in the environment variable CONTAINER_PUSH_REGISTRY.
314 - {project-name}-maven-docker-merge-{stream}
315 - gerrit-maven-docker-merge
316 - github-maven-docker-merge
318 :Required parameters:
320 :container-public-registry: Docker registry source with base images.
321 :container-snapshot-registry: Docker registry target for the deploy action.
323 All other required and optional parameters are identical to the Maven Merge job
329 Produces a release candidate by creating a staging repo in Nexus.
331 The staging repo name is in the format PROJECT-NUMBER for example "aaa-1234",
332 "autorelease-2000", "odlparent-1201", etc...
334 This job runs a Maven build and deploys to $WORKSPACE/m2repo directory. This
335 directory is then used later to deploy to Nexus.
339 - {project-name}-maven-stage-{stream}
343 :Required parameters:
345 :build-node: The node to run build on.
346 :jenkins-ssh-credential: Credential to use for SSH. (Generally should
347 be configured in defaults.yaml)
348 :mvn-settings: The name of settings file containing credentials for the project.
349 :mvn-staging-id: Maven Server ID from settings.xml to pull credentials from.
350 (Note: This setting should be configured in defaults.yaml.)
351 :staging-profile-id: Profile ID of the project's Nexus staging profile.
353 :Optional parameters:
355 :archive-artifacts: Artifacts to archive to the logs server (default: '').
356 :branch: The branch to build against. (default: master)
357 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
358 :build-timeout: Timeout in minutes before aborting build. (default: 60)
359 :cron: Cron schedule when to trigger the job. This parameter also
360 supports multiline input via YAML pipe | character in cases where
361 one may want to provide more than 1 cron timer. (default: '')
362 :deploy-path: The path in Nexus to deploy javadoc to. (default: $PROJECT/$STREAM)
363 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
364 :java-version: Version of Java to use for the build. (default: openjdk8)
365 :mvn-central: Set to 'true' to also stage to OSSRH. This is for projects
366 that want to release to Maven Central. If set the parameter
367 ``ossrh-profile-id`` also needs to be set. (default: false)
368 :maven-versions-plugin: Whether to call Maven versions plugin or not. (default: false)
369 :mvn-global-settings: The name of the Maven global settings to use for
370 Maven configuration. (default: global-settings)
371 :mvn-opts: Sets MAVEN_OPTS. (default: '')
372 :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
373 :mvn-version: Version of maven to use. (default: mvn35)
374 :ossrh-profile-id: Profile ID for project as provided by OSSRH.
376 :sign-artifacts: Sign artifacts with Sigul. (default: false)
377 :stream: Keyword that can be used to represent a release code-name.
378 Often the same as the branch. (default: master)
379 :submodule-recursive: Whether to checkout submodules recursively.
381 :submodule-timeout: Timeout (in minutes) for checkout operation.
384 :gerrit_release_triggers: Override Gerrit Triggers.
386 Maven Stage for Docker
387 ----------------------
389 Produces a release candidate docker image in a Nexus registry.
390 Appropriate for Java projects that do not need to deploy any POM or
393 Similar to Maven Stage as described above but logs in to Docker
394 registries first and skips the lf-maven-deploy builder. The project
395 POM file should invoke a plugin to build and push a Docker image. The
396 base image should be pulled from the registry in the environment
397 variable CONTAINER_PULL_REGISTRY. The new image should be pushed to the
398 registry in the environment variable CONTAINER_PUSH_REGISTRY.
402 - {project-name}-maven-docker-stage-{stream}
403 - gerrit-maven-docker-stage
404 - github-maven-docker-stage
406 :Required parameters:
408 :container-public-registry: Docker registry source with base images.
409 :container-staging-registry: Docker registry target for the deploy action.
411 All other required and optional parameters are identical to the Maven Stage job
419 Sonar job which runs mvn clean install then publishes to Sonar.
421 This job purposely only runs on the master branch as there are Additional
422 configuration needed to support multiple branches and there's not much
423 interest in that kind of support.
427 - {project-name}-sonar
431 :Comment Trigger: run-sonar
433 :Required parameters:
435 :build-node: The node to run build on.
436 :jenkins-ssh-credential: Credential to use for SSH. (Generally should
437 be configured in defaults.yaml)
438 :mvn-settings: The name of settings file containing credentials for the project.
440 :Optional parameters:
442 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
443 :build-timeout: Timeout in minutes before aborting build. (default: 60)
444 :cron: Cron schedule when to trigger the job. This parameter also
445 supports multiline input via YAML pipe | character in cases where
446 one may want to provide more than 1 cron timer. (default: 'H H * * 6'
448 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
449 :java-version: Version of Java to use for the build. (default: openjdk8)
450 :mvn-global-settings: The name of the Maven global settings to use for
451 Maven configuration. (default: global-settings)
452 :mvn-opts: Sets MAVEN_OPTS. (default: '')
453 :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
454 :mvn-version: Version of maven to use. (default: mvn35)
455 :sonar-mvn-goals: Maven goals to run for sonar analysis.
456 (default: sonar:sonar)
457 :sonarcloud: Whether or not to use SonarCloud ``true|false``.
459 :sonarcloud-project-key: SonarCloud project key. (default: '')
460 :sonarcloud-project-organization: SonarCloud project organization.
462 :sonarcloud-api-token: SonarCloud API Token. (default: '')
463 :stream: Keyword that can be used to represent a release code-name.
464 Often the same as the branch. (default: master)
465 :submodule-recursive: Whether to checkout submodules recursively.
467 :submodule-timeout: Timeout (in minutes) for checkout operation.
470 :gerrit_sonar_triggers: Override Gerrit Triggers.
475 .. literalinclude:: ../../.jjb-test/lf-maven-jobs/maven-sonarcloud.yaml
481 Verify job which runs mvn clean install to test a project build..
485 - {project-name}-maven-verify-{stream}-{mvn-version}-{java-version}
486 - gerrit-maven-verify
487 - github-maven-verify
489 :Comment Trigger: recheck|reverify
491 :Required parameters:
493 :build-node: The node to run build on.
494 :jenkins-ssh-credential: Credential to use for SSH. (Generally should
495 be configured in defaults.yaml)
496 :mvn-settings: The name of settings file containing credentials for the project.
498 :Optional parameters:
500 :branch: Git branch to fetch for the build. (default: master)
501 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
502 :build-timeout: Timeout in minutes before aborting build. (default: 60)
503 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
504 :java-version: Version of Java to use for the build. (default: openjdk8)
505 :mvn-global-settings: The name of the Maven global settings to use for
506 Maven configuration. (default: global-settings)
507 :mvn-opts: Sets MAVEN_OPTS. (default: '')
508 :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
509 :mvn-version: Version of maven to use. (default: mvn35)
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.
517 :gerrit_verify_triggers: Override Gerrit Triggers.
518 :gerrit_trigger_file_paths: Override file paths which can be used to
519 filter which file modifications will trigger a build.
521 Maven Verify for Docker
522 -----------------------
524 Similar to Maven Verify as described above but logs in to Docker
525 registries first. The project POM file should invoke a plugin to build
526 a Docker image. The base image should be pulled from the registry in
527 the environment variable CONTAINER_PULL_REGISTRY.
531 - {project-name}-maven-docker-verify-{stream}-{mvn-version}-{java-version}
532 - gerrit-maven-docker-verify
533 - github-maven-docker-verify
535 :Required parameters:
537 :container-public-registry: Docker registry source with base images.
539 All other required and optional parameters are identical to the Maven Verify job
542 Maven Verify w/ Dependencies
543 ----------------------------
545 Verify job which runs mvn clean install to test a project build /w deps
547 This job can be used to verify a patch in conjunction to all of the
548 upstream patches it depends on. The user of this job can provide a list
553 - {project-name}-maven-verify-deps-{stream}-{mvn-version}-{java-version}
554 - gerrit-maven-verify-dependencies
556 :Comment Trigger: recheck: SPACE_SEPARATED_LIST_OF_PATCHES
558 :Required parameters:
560 :build-node: The node to run build on.
561 :jenkins-ssh-credential: Credential to use for SSH. (Generally should
562 be configured in defaults.yaml)
563 :mvn-settings: The name of settings file containing credentials for the project.
565 :Optional parameters:
567 :branch: Git branch to fetch for the build. (default: master)
568 :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
569 :build-timeout: Timeout in minutes before aborting build. (default: 60)
570 :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
571 :java-version: Version of Java to use for the build. (default: openjdk8)
572 :mvn-global-settings: The name of the Maven global settings to use for
573 Maven configuration. (default: global-settings)
574 :mvn-opts: Sets MAVEN_OPTS. (default: '')
575 :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
576 :mvn-version: Version of maven to use. (default: mvn35)
577 :stream: Keyword that can be used to represent a release code-name.
578 Often the same as the branch. (default: master)
579 :submodule-recursive: Whether to checkout submodules recursively.
581 :submodule-timeout: Timeout (in minutes) for checkout operation.
584 :gerrit_verify_triggers: Override Gerrit Triggers.
585 :gerrit_trigger_file_paths: Override file paths which can be used to
586 filter which file modifications will trigger a build.