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

jreleaser / jreleaser / #556

22 Nov 2025 04:17PM UTC coverage: 46.213% (-2.0%) from 48.203%
#556

push

github

aalmiray
feat(jdks): Allow filtering by platform

Closes #2000

Co-authored-by: Ixchel Ruiz <ixchelruiz@yahoo.com>

0 of 42 new or added lines in 5 files covered. (0.0%)

1116 existing lines in 107 files now uncovered.

24939 of 53965 relevant lines covered (46.21%)

0.46 hits per line

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

2.04
/plugins/jreleaser/src/main/java/org/jreleaser/cli/TemplateGenerate.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.cli;
19

20
import org.jreleaser.model.JReleaserException;
21
import org.jreleaser.templates.TemplateGenerationException;
22
import org.jreleaser.templates.TemplateGenerator;
23
import picocli.CommandLine;
24

25
import java.nio.file.Path;
26
import java.nio.file.Paths;
27
import java.util.Set;
28

29
/**
30
 * @author Andres Almiray
31
 * @since 0.10.0
32
 */
33
@CommandLine.Command(name = "generate")
34
public class TemplateGenerate extends AbstractLoggingCommand<Template> {
1✔
35
    @CommandLine.ArgGroup(multiplicity = "1")
36
    Composite composite;
37

UNCOV
38
    static class Composite {
×
39
        @CommandLine.ArgGroup(exclusive = false, order = 1,
40
            headingKey = "announcer.header")
41
        Announcers announcers;
42

43
        @CommandLine.ArgGroup(exclusive = false, order = 1,
44
            headingKey = "assembler.header")
45
        Assemblers assemblers;
46

47
        @CommandLine.ArgGroup(exclusive = false, order = 2,
48
            headingKey = "packager.header")
49
        Packagers packagers;
50

51
        String announcerName() {
UNCOV
52
            return null != announcers ? announcers.announcerName : null;
×
53
        }
54

55
        String assemblerType() {
UNCOV
56
            return null != assemblers ? assemblers.assemblerType : null;
×
57
        }
58

59
        String assemblerName() {
UNCOV
60
            return null != assemblers ? assemblers.assemblerName : null;
×
61
        }
62

63
        String packagerName() {
UNCOV
64
            return null != packagers ? packagers.packagerName : null;
×
65
        }
66

67
        String distributionName() {
UNCOV
68
            return null != packagers ? packagers.distributionName : null;
×
69
        }
70

71
        org.jreleaser.model.Distribution.DistributionType distributionType() {
UNCOV
72
            return null != packagers ? packagers.distributionType : null;
×
73
        }
74
    }
75

UNCOV
76
    static class Announcers {
×
77
        @CommandLine.Option(names = {"-a", "--announcer"},
78
            paramLabel = "<announcer>",
79
            descriptionKey = "announcer.name",
80
            required = true)
81
        String announcerName;
82
    }
83

UNCOV
84
    static class Assemblers {
×
85
        @CommandLine.Option(names = {"-st", "--assembler-type"},
86
            paramLabel = "<type>",
87
            descriptionKey = "assembler.type",
88
            required = true)
89
        String assemblerType;
90

91
        @CommandLine.Option(names = {"-s", "--assembler-name"},
92
            paramLabel = "<name>",
93
            descriptionKey = "assembler.name",
94
            required = true)
95
        String assemblerName;
96
    }
97

UNCOV
98
    static class Packagers {
×
99
        @CommandLine.Option(names = {"-d", "--distribution"},
100
            paramLabel = "<distribution>",
101
            required = true)
102
        String distributionName;
103

104
        @CommandLine.Option(names = {"-p", "--packager"},
105
            paramLabel = "<packager>",
106
            required = true)
107
        String packagerName;
108

109
        @CommandLine.Option(names = {"-dt", "--distribution-type"},
110
            paramLabel = "<type>",
111
            required = true,
112
            defaultValue = "JAVA_BINARY")
113
        org.jreleaser.model.Distribution.DistributionType distributionType;
114
    }
115

116
    @CommandLine.Option(names = {"-o", "--overwrite"})
117
    boolean overwrite;
118

119
    @CommandLine.Option(names = {"-sn", "--snapshot"})
120
    boolean snapshot;
121

122
    @Override
123
    protected void collectCandidateDeprecatedArgs(Set<AbstractCommand.DeprecatedArg> args) {
UNCOV
124
        super.collectCandidateDeprecatedArgs(args);
×
UNCOV
125
        args.add(new DeprecatedArg("-sn", "--snapshot", "1.5.0"));
×
UNCOV
126
        args.add(new DeprecatedArg("-d", "--distribution", "1.5.0"));
×
UNCOV
127
        args.add(new DeprecatedArg("-xd", "--exclude-distribution", "1.5.0"));
×
UNCOV
128
        args.add(new DeprecatedArg("-p", "--packager", "1.5.0"));
×
UNCOV
129
        args.add(new DeprecatedArg("-xp", "--exclude-packager", "1.5.0"));
×
UNCOV
130
        args.add(new DeprecatedArg("-a", "--announcer", "1.5.0"));
×
UNCOV
131
        args.add(new DeprecatedArg("-s", "--assembler", "1.5.0"));
×
UNCOV
132
        args.add(new DeprecatedArg("-st", "--assembler-type", "1.5.0"));
×
UNCOV
133
        args.add(new DeprecatedArg("-dt", "--distribution-type", "1.5.0"));
×
UNCOV
134
    }
×
135

136
    @Override
137
    protected void execute() {
138
        try {
UNCOV
139
            basedir = null != basedir ? basedir : Paths.get(".").normalize();
×
140

UNCOV
141
            initLogger();
×
142

UNCOV
143
            Path outputDirectory = basedir
×
UNCOV
144
                .resolve("src")
×
UNCOV
145
                .resolve("jreleaser");
×
146

UNCOV
147
            Path output = TemplateGenerator.builder()
×
UNCOV
148
                .logger(logger)
×
UNCOV
149
                .distributionName(composite.distributionName())
×
UNCOV
150
                .distributionType(composite.distributionType())
×
UNCOV
151
                .packagerName(composite.packagerName())
×
UNCOV
152
                .announcerName(composite.announcerName())
×
UNCOV
153
                .assemblerType(composite.assemblerType())
×
UNCOV
154
                .assemblerName(composite.assemblerName())
×
UNCOV
155
                .outputDirectory(outputDirectory)
×
UNCOV
156
                .overwrite(overwrite)
×
UNCOV
157
                .snapshot(snapshot)
×
UNCOV
158
                .build()
×
UNCOV
159
                .generate();
×
160

UNCOV
161
            if (null != output && !quiet) {
×
UNCOV
162
                logger.info($("jreleaser.template.generate.TEXT_success"), output.toAbsolutePath());
×
163
            }
164
        } catch (TemplateGenerationException e) {
×
165
            throw new JReleaserException($("ERROR_unexpected_error"), e);
×
166
        } finally {
UNCOV
167
            if (null != logger) logger.close();
×
168
        }
UNCOV
169
    }
×
170

171
    @Override
172
    protected Path getOutputDirectory() {
UNCOV
173
        if (null != outputdir) {
×
174
            return outputdir.resolve("jreleaser");
×
175
        }
UNCOV
176
        return basedir.resolve("out").resolve("jreleaser");
×
177
    }
178
}
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