• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jreleaser / jreleaser / #510

27 Jul 2025 12:31PM UTC coverage: 45.783% (-3.6%) from 49.39%
#510

push

github

aalmiray
feat(packagers): Stage distribution publication in a fixed directory

Closes #1943

12 of 25 new or added lines in 4 files covered. (48.0%)

2208 existing lines in 190 files now uncovered.

23924 of 52255 relevant lines covered (45.78%)

0.46 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/core/jreleaser-engine/src/main/java/org/jreleaser/engine/context/ModelAutoConfigurer.java
1
/*
2
 * SPDX-License-Identifier: Apache-2.0
3
 *
4
 * Copyright 2020-2025 The JReleaser authors.
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *     https://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
package org.jreleaser.engine.context;
19

20
import org.jreleaser.bundle.RB;
21
import org.jreleaser.logging.JReleaserLogger;
22
import org.jreleaser.model.Active;
23
import org.jreleaser.model.JReleaserException;
24
import org.jreleaser.model.JReleaserVersion;
25
import org.jreleaser.model.UpdateSection;
26
import org.jreleaser.model.api.JReleaserCommand;
27
import org.jreleaser.model.api.JReleaserContext.Mode;
28
import org.jreleaser.model.internal.JReleaserContext;
29
import org.jreleaser.model.internal.JReleaserModel;
30
import org.jreleaser.model.internal.common.Artifact;
31
import org.jreleaser.model.internal.release.BaseReleaser;
32
import org.jreleaser.model.internal.release.CodebergReleaser;
33
import org.jreleaser.model.internal.release.GithubReleaser;
34
import org.jreleaser.model.internal.release.GitlabReleaser;
35
import org.jreleaser.model.internal.util.Artifacts;
36
import org.jreleaser.model.spi.release.Repository;
37
import org.jreleaser.sdk.git.GitSdk;
38
import org.jreleaser.util.Env;
39

40
import java.io.IOException;
41
import java.nio.file.Path;
42
import java.util.ArrayList;
43
import java.util.LinkedHashSet;
44
import java.util.List;
45
import java.util.Set;
46

47
import static java.util.Objects.requireNonNull;
48
import static org.jreleaser.util.StringUtils.isNotBlank;
49

50
/**
51
 * @author Andres Almiray
52
 * @since 0.3.0
53
 */
54
public final class ModelAutoConfigurer {
55
    private static final String GLOB_PREFIX = "glob:";
56
    private static final String REGEX_PREFIX = "regex:";
57

UNCOV
58
    private final List<String> authors = new ArrayList<>();
×
UNCOV
59
    private final List<String> files = new ArrayList<>();
×
UNCOV
60
    private final List<String> globs = new ArrayList<>();
×
UNCOV
61
    private final List<String> selectedPlatforms = new ArrayList<>();
×
UNCOV
62
    private final List<String> rejectedPlatforms = new ArrayList<>();
×
UNCOV
63
    private final Set<UpdateSection> updateSections = new LinkedHashSet<>();
×
64
    private JReleaserLogger logger;
65
    private Path basedir;
66
    private Path outputDirectory;
67
    private Boolean yolo;
68
    private Boolean dryrun;
69
    private Boolean gitRootSearch;
70
    private Boolean strict;
71
    private String projectName;
72
    private String projectVersion;
73
    private String projectVersionPattern;
74
    private String projectSnapshotPattern;
75
    private String projectSnapshotLabel;
76
    private boolean projectSnapshotFullChangelog;
77
    private String projectCopyright;
78
    private String projectDescription;
79
    private String projectInceptionYear;
80
    private String projectStereotype;
81
    private String tagName;
82
    private String previousTagName;
83
    private String releaseName;
84
    private String milestoneName;
85
    private String branch;
86
    private Boolean prerelease;
87
    private String prereleasePattern;
88
    private Boolean draft;
89
    private boolean overwrite;
90
    private boolean update;
91
    private boolean skipTag;
92
    private boolean skipRelease;
93
    private boolean skipChecksums;
94
    private String changelog;
95
    private boolean changelogFormatted;
96
    private String username;
97
    private String commitAuthorName;
98
    private String commitAuthorEmail;
99
    private boolean signing;
100
    private boolean armored;
101

UNCOV
102
    private ModelAutoConfigurer() {
×
103
        // noop
UNCOV
104
    }
×
105

106
    public ModelAutoConfigurer logger(JReleaserLogger logger) {
UNCOV
107
        this.logger = logger;
×
UNCOV
108
        return this;
×
109
    }
110

111
    public ModelAutoConfigurer basedir(Path basedir) {
UNCOV
112
        this.basedir = basedir;
×
UNCOV
113
        return this;
×
114
    }
115

116
    public ModelAutoConfigurer outputDirectory(Path outputDirectory) {
UNCOV
117
        this.outputDirectory = outputDirectory;
×
UNCOV
118
        return this;
×
119
    }
120

121
    public ModelAutoConfigurer yolo(Boolean yolo) {
UNCOV
122
        this.yolo = yolo;
×
UNCOV
123
        return this;
×
124
    }
125

126
    public ModelAutoConfigurer dryrun(Boolean dryrun) {
UNCOV
127
        this.dryrun = dryrun;
×
UNCOV
128
        return this;
×
129
    }
130

131
    public ModelAutoConfigurer gitRootSearch(Boolean gitRootSearch) {
UNCOV
132
        this.gitRootSearch = gitRootSearch;
×
UNCOV
133
        return this;
×
134
    }
135

136
    public ModelAutoConfigurer strict(Boolean strict) {
UNCOV
137
        this.strict = strict;
×
UNCOV
138
        return this;
×
139
    }
140

141
    public ModelAutoConfigurer projectName(String projectName) {
UNCOV
142
        this.projectName = projectName;
×
UNCOV
143
        return this;
×
144
    }
145

146
    public ModelAutoConfigurer projectVersion(String projectVersion) {
UNCOV
147
        this.projectVersion = projectVersion;
×
UNCOV
148
        return this;
×
149
    }
150

151
    public ModelAutoConfigurer projectVersionPattern(String projectVersionPattern) {
UNCOV
152
        this.projectVersionPattern = projectVersionPattern;
×
UNCOV
153
        return this;
×
154
    }
155

156
    public ModelAutoConfigurer projectSnapshotPattern(String projectSnapshotPattern) {
UNCOV
157
        this.projectSnapshotPattern = projectSnapshotPattern;
×
UNCOV
158
        return this;
×
159
    }
160

161
    public ModelAutoConfigurer projectSnapshotLabel(String projectSnapshotLabel) {
UNCOV
162
        this.projectSnapshotLabel = projectSnapshotLabel;
×
UNCOV
163
        return this;
×
164
    }
165

166
    public ModelAutoConfigurer projectSnapshotFullChangelog(boolean projectSnapshotFullChangelog) {
UNCOV
167
        this.projectSnapshotFullChangelog = projectSnapshotFullChangelog;
×
UNCOV
168
        return this;
×
169
    }
170

171
    public ModelAutoConfigurer projectCopyright(String projectCopyright) {
UNCOV
172
        this.projectCopyright = projectCopyright;
×
UNCOV
173
        return this;
×
174
    }
175

176
    public ModelAutoConfigurer projectDescription(String projectDescription) {
UNCOV
177
        this.projectDescription = projectDescription;
×
UNCOV
178
        return this;
×
179
    }
180

181
    public ModelAutoConfigurer projectInceptionYear(String projectInceptionYear) {
UNCOV
182
        this.projectInceptionYear = projectInceptionYear;
×
UNCOV
183
        return this;
×
184
    }
185

186
    public ModelAutoConfigurer projectStereotype(String projectStereotype) {
UNCOV
187
        this.projectStereotype = projectStereotype;
×
UNCOV
188
        return this;
×
189
    }
190

191
    public ModelAutoConfigurer tagName(String tagName) {
UNCOV
192
        this.tagName = tagName;
×
UNCOV
193
        return this;
×
194
    }
195

196
    public ModelAutoConfigurer previousTagName(String previousTagName) {
UNCOV
197
        this.previousTagName = previousTagName;
×
UNCOV
198
        return this;
×
199
    }
200

201
    public ModelAutoConfigurer branch(String branch) {
UNCOV
202
        this.branch = branch;
×
UNCOV
203
        return this;
×
204
    }
205

206
    public ModelAutoConfigurer releaseName(String releaseName) {
UNCOV
207
        this.releaseName = releaseName;
×
UNCOV
208
        return this;
×
209
    }
210

211
    public ModelAutoConfigurer milestoneName(String milestoneName) {
UNCOV
212
        this.milestoneName = milestoneName;
×
UNCOV
213
        return this;
×
214
    }
215

216
    public ModelAutoConfigurer prerelease(Boolean prerelease) {
UNCOV
217
        this.prerelease = prerelease;
×
UNCOV
218
        return this;
×
219
    }
220

221
    public ModelAutoConfigurer prereleasePattern(String prereleasePattern) {
UNCOV
222
        this.prereleasePattern = prereleasePattern;
×
UNCOV
223
        return this;
×
224
    }
225

226
    public ModelAutoConfigurer draft(Boolean draft) {
UNCOV
227
        this.draft = draft;
×
UNCOV
228
        return this;
×
229
    }
230

231
    public ModelAutoConfigurer overwrite(boolean overwrite) {
UNCOV
232
        this.overwrite = overwrite;
×
UNCOV
233
        return this;
×
234
    }
235

236
    public ModelAutoConfigurer update(boolean update) {
UNCOV
237
        this.update = update;
×
UNCOV
238
        return this;
×
239
    }
240

241
    public ModelAutoConfigurer updateSections(Set<UpdateSection> updateSections) {
UNCOV
242
        this.updateSections.clear();
×
UNCOV
243
        if (null != updateSections && !updateSections.isEmpty()) {
×
244
            updateSections.forEach(this::updateSection);
×
245
        }
UNCOV
246
        return this;
×
247
    }
248

249
    public ModelAutoConfigurer updateSection(UpdateSection updateSection) {
250
        if (null != updateSection) {
×
251
            this.updateSections.add(updateSection);
×
252
        }
253
        return this;
×
254
    }
255

256
    public ModelAutoConfigurer skipTag(boolean skipTag) {
UNCOV
257
        this.skipTag = skipTag;
×
UNCOV
258
        return this;
×
259
    }
260

261
    public ModelAutoConfigurer skipRelease(boolean skipRelease) {
UNCOV
262
        this.skipRelease = skipRelease;
×
UNCOV
263
        return this;
×
264
    }
265

266
    public ModelAutoConfigurer skipChecksums(boolean skipChecksums) {
UNCOV
267
        this.skipChecksums = skipChecksums;
×
UNCOV
268
        return this;
×
269
    }
270

271
    public ModelAutoConfigurer changelog(String changelog) {
UNCOV
272
        this.changelog = changelog;
×
UNCOV
273
        return this;
×
274
    }
275

276
    public ModelAutoConfigurer changelogFormatted(boolean changelogFormatted) {
UNCOV
277
        this.changelogFormatted = changelogFormatted;
×
UNCOV
278
        return this;
×
279
    }
280

281
    public ModelAutoConfigurer username(String username) {
UNCOV
282
        this.username = username;
×
UNCOV
283
        return this;
×
284
    }
285

286
    public ModelAutoConfigurer commitAuthorName(String commitAuthorName) {
UNCOV
287
        this.commitAuthorName = commitAuthorName;
×
UNCOV
288
        return this;
×
289
    }
290

291
    public ModelAutoConfigurer commitAuthorEmail(String commitAuthorEmail) {
UNCOV
292
        this.commitAuthorEmail = commitAuthorEmail;
×
UNCOV
293
        return this;
×
294
    }
295

296
    public ModelAutoConfigurer signing(boolean signing) {
UNCOV
297
        this.signing = signing;
×
UNCOV
298
        return this;
×
299
    }
300

301
    public ModelAutoConfigurer armored(boolean armored) {
UNCOV
302
        this.armored = armored;
×
UNCOV
303
        return this;
×
304
    }
305

306
    public ModelAutoConfigurer authors(List<String> authors) {
UNCOV
307
        this.authors.clear();
×
UNCOV
308
        if (null != authors && !authors.isEmpty()) {
×
309
            authors.forEach(this::file);
×
310
        }
UNCOV
311
        return this;
×
312
    }
313

314
    public ModelAutoConfigurer author(String author) {
315
        if (isNotBlank(author)) {
×
316
            this.authors.add(author.trim());
×
317
        }
318
        return this;
×
319
    }
320

321
    public ModelAutoConfigurer files(List<String> files) {
UNCOV
322
        this.files.clear();
×
UNCOV
323
        if (null != files && !files.isEmpty()) {
×
324
            files.forEach(this::file);
×
325
        }
UNCOV
326
        return this;
×
327
    }
328

329
    public ModelAutoConfigurer file(String file) {
330
        if (isNotBlank(file)) {
×
331
            this.files.add(file.trim());
×
332
        }
333
        return this;
×
334
    }
335

336
    public ModelAutoConfigurer globs(List<String> globs) {
UNCOV
337
        this.globs.clear();
×
UNCOV
338
        if (null != globs && !globs.isEmpty()) {
×
339
            globs.forEach(this::glob);
×
340
        }
UNCOV
341
        return this;
×
342
    }
343

344
    public ModelAutoConfigurer glob(String glob) {
345
        if (isNotBlank(glob)) {
×
346
            if (glob.startsWith(GLOB_PREFIX) || glob.startsWith(REGEX_PREFIX)) {
×
347
                this.globs.add(glob.trim());
×
348
            } else {
349
                this.globs.add(GLOB_PREFIX + glob.trim());
×
350
            }
351
        }
352
        return this;
×
353
    }
354

355
    public ModelAutoConfigurer selectedPlatforms(List<String> platforms) {
UNCOV
356
        this.selectedPlatforms.clear();
×
UNCOV
357
        if (null != platforms && !platforms.isEmpty()) {
×
358
            platforms.forEach(this::selectedPlatform);
×
359
        }
UNCOV
360
        return this;
×
361
    }
362

363
    public ModelAutoConfigurer selectedPlatform(String platform) {
364
        if (isNotBlank(platform)) {
×
365
            this.selectedPlatforms.add(platform.trim());
×
366
        }
367
        return this;
×
368
    }
369

370
    public ModelAutoConfigurer rejectedPlatforms(List<String> platforms) {
UNCOV
371
        this.rejectedPlatforms.clear();
×
UNCOV
372
        if (null != platforms && !platforms.isEmpty()) {
×
373
            platforms.forEach(this::rejectedPlatform);
×
374
        }
UNCOV
375
        return this;
×
376
    }
377

378
    public ModelAutoConfigurer rejectedPlatform(String platform) {
379
        if (isNotBlank(platform)) {
×
380
            this.rejectedPlatforms.add(platform.trim());
×
381
        }
382
        return this;
×
383
    }
384

385
    public JReleaserContext autoConfigure() {
UNCOV
386
        requireNonNull(logger, "Argument 'logger' ust not be null");
×
UNCOV
387
        requireNonNull(basedir, "Argument 'basedir' ust not be null");
×
UNCOV
388
        requireNonNull(outputDirectory, "Argument 'outputDirectory' ust not be null");
×
389

UNCOV
390
        logger.info("JReleaser {}", JReleaserVersion.getPlainVersion());
×
UNCOV
391
        JReleaserVersion.banner(logger.getTracer());
×
UNCOV
392
        logger.info(RB.$("context.configurer.auto-config.on"));
×
UNCOV
393
        logger.increaseIndent();
×
UNCOV
394
        logger.info(RB.$("context.configurer.basedir.set"), basedir.toAbsolutePath());
×
UNCOV
395
        dumpAutoConfig();
×
UNCOV
396
        logger.decreaseIndent();
×
UNCOV
397
        return createAutoConfiguredContext();
×
398
    }
399

400
    private JReleaserContext createAutoConfiguredContext() {
UNCOV
401
        return ContextCreator.create(
×
402
            logger,
403
            JReleaserContext.Configurer.CLI,
404
            Mode.FULL,
405
            JReleaserCommand.RELEASE,
UNCOV
406
            autoConfiguredModel(basedir),
×
407
            basedir,
408
            outputDirectory,
UNCOV
409
            resolveBoolean(org.jreleaser.model.api.JReleaserContext.YOLO, yolo),
×
UNCOV
410
            resolveBoolean(org.jreleaser.model.api.JReleaserContext.DRY_RUN, dryrun),
×
UNCOV
411
            resolveBoolean(org.jreleaser.model.api.JReleaserContext.GIT_ROOT_SEARCH, gitRootSearch),
×
UNCOV
412
            resolveBoolean(org.jreleaser.model.api.JReleaserContext.STRICT, strict),
×
413
            selectedPlatforms,
414
            rejectedPlatforms);
415
    }
416

417
    private boolean resolveBoolean(String key, Boolean value) {
UNCOV
418
        if (null != value) return value;
×
UNCOV
419
        String resolvedValue = Env.resolve(key, "");
×
UNCOV
420
        return isNotBlank(resolvedValue) && Boolean.parseBoolean(resolvedValue);
×
421
    }
422

423
    private void dumpAutoConfig() {
UNCOV
424
        if (isNotBlank(projectName)) logger.info("- project.name: {}", projectName);
×
UNCOV
425
        if (isNotBlank(projectVersion)) logger.info("- project.version: {}", projectVersion);
×
UNCOV
426
        if (isNotBlank(projectVersionPattern)) logger.info("- project.version.pattern: {}", projectVersionPattern);
×
UNCOV
427
        if (isNotBlank(projectSnapshotPattern)) logger.info("- project.snapshot.pattern: {}", projectSnapshotPattern);
×
UNCOV
428
        if (isNotBlank(projectSnapshotLabel)) logger.info("- project.snapshot.label: {}", projectSnapshotLabel);
×
UNCOV
429
        if (projectSnapshotFullChangelog) logger.info("- project.snapshot.full.changelog: true");
×
UNCOV
430
        if (isNotBlank(projectDescription)) logger.info("- project.description: {}", projectDescription);
×
UNCOV
431
        if (isNotBlank(projectCopyright)) logger.info("- project.copyright: {}", projectCopyright);
×
UNCOV
432
        if (isNotBlank(projectInceptionYear)) logger.info("- project.inceptionYear: {}", projectInceptionYear);
×
UNCOV
433
        if (isNotBlank(projectStereotype)) logger.info("- project.stereotype: {}", projectStereotype);
×
UNCOV
434
        if (!authors.isEmpty()) {
×
435
            for (String author : authors) {
×
436
                logger.info("- author: {}", author);
×
437
            }
×
438
        }
UNCOV
439
        if (isNotBlank(username)) logger.info("- release.username: {}", username);
×
UNCOV
440
        if (isNotBlank(tagName)) logger.info("- release.tagName: {}", tagName);
×
UNCOV
441
        if (isNotBlank(previousTagName)) logger.info("- release.previousTagName: {}", previousTagName);
×
UNCOV
442
        if (isNotBlank(branch)) logger.info("- release.branch: {}", branch);
×
UNCOV
443
        if (isNotBlank(releaseName)) logger.info("- release.releaseName: {}", releaseName);
×
UNCOV
444
        if (isNotBlank(milestoneName)) logger.info("- release.milestone.name: {}", milestoneName);
×
UNCOV
445
        if (overwrite) logger.info("- release.overwrite: true");
×
UNCOV
446
        if (update) logger.info("- release.update: true");
×
UNCOV
447
        if (!updateSections.isEmpty()) logger.info("- release.updateSections: " + updateSections);
×
UNCOV
448
        if (skipTag) logger.info("- release.skipTag: true");
×
UNCOV
449
        if (skipRelease) logger.info("- release.skipRelease: true");
×
UNCOV
450
        if (skipChecksums) logger.info("- checksums.disabled: true");
×
UNCOV
451
        if (null != prerelease && prerelease) logger.info("- release.prerelease: true");
×
UNCOV
452
        if (isNotBlank(prereleasePattern)) logger.info("- release.prerelease.pattern: {}", prereleasePattern);
×
UNCOV
453
        if (null != draft && draft) logger.info("- release.draft: true");
×
UNCOV
454
        if (isNotBlank(changelog)) logger.info(" - release.changelog: {}", changelog);
×
UNCOV
455
        if (changelogFormatted) logger.info("- release.changelog.formatted: true");
×
UNCOV
456
        if (isNotBlank(commitAuthorName)) logger.info("- release.commitAuthor.name: {}", commitAuthorName);
×
UNCOV
457
        if (isNotBlank(commitAuthorEmail)) logger.info("- release.commitAuthor.email: {}", commitAuthorEmail);
×
UNCOV
458
        if (signing) logger.info("- signing.enabled: true");
×
UNCOV
459
        if (armored) logger.info("- signing.armored: true");
×
UNCOV
460
        if (!files.isEmpty()) {
×
461
            for (String file : files) {
×
462
                logger.info("- file: {}", basedir.relativize(basedir.resolve(file)));
×
463
            }
×
464
        }
UNCOV
465
        if (!globs.isEmpty()) {
×
466
            for (String glob : globs) {
×
467
                logger.info("- glob: {}", glob);
×
468
            }
×
469
        }
UNCOV
470
        if (!selectedPlatforms.isEmpty()) {
×
471
            for (String platform : selectedPlatforms) {
×
472
                logger.info("- platform: {}", platform);
×
473
            }
×
474
        }
UNCOV
475
        if (!rejectedPlatforms.isEmpty()) {
×
476
            for (String platform : rejectedPlatforms) {
×
477
                logger.info("- !platform: {}", platform);
×
478
            }
×
479
        }
UNCOV
480
    }
×
481

482
    private JReleaserModel autoConfiguredModel(Path basedir) {
UNCOV
483
        JReleaserModel model = new JReleaserModel();
×
UNCOV
484
        model.getProject().setName(projectName);
×
UNCOV
485
        model.getProject().setDescription(projectDescription);
×
UNCOV
486
        model.getProject().setCopyright(projectCopyright);
×
UNCOV
487
        model.getProject().setStereotype(projectStereotype);
×
UNCOV
488
        model.getProject().setInceptionYear(projectInceptionYear);
×
UNCOV
489
        model.getProject().setAuthors(authors);
×
UNCOV
490
        model.getProject().setVersion(projectVersion);
×
UNCOV
491
        model.getProject().setVersionPattern(projectVersionPattern);
×
UNCOV
492
        model.getProject().getSnapshot().setPattern(projectSnapshotPattern);
×
UNCOV
493
        model.getProject().getSnapshot().setLabel(projectSnapshotLabel);
×
UNCOV
494
        model.getProject().getSnapshot().setFullChangelog(projectSnapshotFullChangelog);
×
495

496
        try {
UNCOV
497
            boolean grs = resolveBoolean(org.jreleaser.model.api.JReleaserContext.GIT_ROOT_SEARCH, gitRootSearch);
×
UNCOV
498
            Repository repository = GitSdk.of(basedir, grs).getRemote();
×
UNCOV
499
            BaseReleaser<?, ?> service = null;
×
UNCOV
500
            switch (repository.getKind()) {
×
501
                case GITHUB:
UNCOV
502
                    service = new GithubReleaser();
×
UNCOV
503
                    model.getRelease().setGithub((GithubReleaser) service);
×
UNCOV
504
                    service.getPrerelease().setEnabled(prerelease);
×
UNCOV
505
                    service.getPrerelease().setPattern(prereleasePattern);
×
UNCOV
506
                    ((GithubReleaser) service).setDraft(draft);
×
UNCOV
507
                    break;
×
508
                case GITLAB:
509
                    service = new GitlabReleaser();
×
510
                    model.getRelease().setGitlab((GitlabReleaser) service);
×
511
                    break;
×
512
                case CODEBERG:
513
                    service = new CodebergReleaser();
×
514
                    model.getRelease().setCodeberg((CodebergReleaser) service);
×
515
                    service.getPrerelease().setEnabled(prerelease);
×
516
                    service.getPrerelease().setPattern(prereleasePattern);
×
517
                    ((CodebergReleaser) service).setDraft(draft);
×
518
                    break;
×
519
                default:
520
                    throw new JReleaserException(RB.$("ERROR_context_configurer_unsupported_url", repository.getHttpUrl()));
×
521
            }
522

UNCOV
523
            service.setUsername(username);
×
UNCOV
524
            service.setTagName(tagName);
×
UNCOV
525
            service.setPreviousTagName(previousTagName);
×
UNCOV
526
            service.setReleaseName(releaseName);
×
UNCOV
527
            service.getMilestone().setName(milestoneName);
×
UNCOV
528
            service.setOverwrite(overwrite);
×
UNCOV
529
            service.getUpdate().setEnabled(update);
×
UNCOV
530
            if (!updateSections.isEmpty()) {
×
531
                if (!update) {
×
532
                    throw new JReleaserException(RB.$("ERROR_context_configurer_update_not_set"));
×
533
                }
534
                service.getUpdate().setSections(updateSections);
×
535
            }
UNCOV
536
            service.setSkipTag(skipTag);
×
UNCOV
537
            service.setSkipRelease(skipRelease);
×
UNCOV
538
            if (isNotBlank(branch)) service.setBranch(branch);
×
UNCOV
539
            if (isNotBlank(changelog)) service.getChangelog().setExternal(changelog);
×
UNCOV
540
            if (isNotBlank(commitAuthorName)) service.getCommitAuthor().setName(commitAuthorName);
×
UNCOV
541
            if (isNotBlank(commitAuthorEmail)) service.getCommitAuthor().setEmail(commitAuthorEmail);
×
UNCOV
542
            if (changelogFormatted) service.getChangelog().setFormatted(Active.ALWAYS);
×
543
        } catch (IOException e) {
×
544
            throw new JReleaserException(e.getMessage());
×
UNCOV
545
        }
×
546

UNCOV
547
        if (skipChecksums) {
×
548
            model.getChecksum().setArtifacts(false);
×
549
            model.getChecksum().setFiles(false);
×
550
            model.getSigning().setChecksums(false);
×
551
        }
552

UNCOV
553
        if (signing) {
×
554
            model.getSigning().setActive(Active.ALWAYS);
×
555
            model.getSigning().setArmored(armored);
×
556
        }
557

UNCOV
558
        if (!files.isEmpty()) {
×
559
            for (String file : files) {
×
560
                model.getFiles().addArtifact(Artifact.of(basedir.resolve(file)));
×
561
            }
×
562
        }
563

UNCOV
564
        if (!globs.isEmpty()) {
×
565
            model.getFiles().addArtifacts(Artifacts.resolveFiles(logger, basedir, globs));
×
566
        }
567

UNCOV
568
        return model;
×
569
    }
570

571
    public static ModelAutoConfigurer builder() {
UNCOV
572
        return new ModelAutoConfigurer();
×
573
    }
574
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc