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

jreleaser / jreleaser / #558

08 Dec 2025 02:56PM UTC coverage: 48.239% (+0.02%) from 48.215%
#558

push

github

aalmiray
feat(core): warn when a name template cannot be resolved

Closes #1960

Closes #1961

299 of 573 new or added lines in 133 files covered. (52.18%)

4 existing lines in 4 files now uncovered.

26047 of 53996 relevant lines covered (48.24%)

0.48 hits per line

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

77.92
/core/jreleaser-model-impl/src/main/java/org/jreleaser/model/internal/common/JvmOptions.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.model.internal.common;
19

20
import com.fasterxml.jackson.annotation.JsonIgnore;
21
import org.jreleaser.model.internal.JReleaserContext;
22
import org.jreleaser.mustache.TemplateContext;
23

24
import java.util.ArrayList;
25
import java.util.LinkedHashMap;
26
import java.util.List;
27
import java.util.Map;
28
import java.util.Set;
29

30
import static java.lang.System.lineSeparator;
31
import static java.util.Collections.unmodifiableList;
32
import static java.util.Collections.unmodifiableMap;
33
import static java.util.stream.Collectors.toList;
34
import static org.jreleaser.mustache.Templates.resolveTemplate;
35

36
/**
37
 * @author Andres Almiray
38
 * @since 0.13.0
39
 */
40
public final class JvmOptions extends AbstractModelObject<JvmOptions> implements Domain {
1✔
41
    //private static final long serialVersionUID = 4713757280623221679L;
42

43
    private final List<String> universal = new ArrayList<>();
1✔
44
    private final List<String> unix = new ArrayList<>();
1✔
45
    private final List<String> linux = new ArrayList<>();
1✔
46
    private final List<String> osx = new ArrayList<>();
1✔
47
    private final List<String> windows = new ArrayList<>();
1✔
48

49
    @JsonIgnore
1✔
50
    private final org.jreleaser.model.api.common.JvmOptions immutable = new org.jreleaser.model.api.common.JvmOptions() {
1✔
51
        private static final long serialVersionUID = -7553541254718019915L;
52

53
        @Override
54
        public List<String> getUniversal() {
55
            return unmodifiableList(universal);
×
56
        }
57

58
        @Override
59
        public List<String> getUnix() {
60
            return unmodifiableList(unix);
×
61
        }
62

63
        @Override
64
        public List<String> getLinux() {
65
            return unmodifiableList(linux);
×
66
        }
67

68
        @Override
69
        public List<String> getOsx() {
70
            return unmodifiableList(osx);
×
71
        }
72

73
        @Override
74
        public List<String> getWindows() {
75
            return unmodifiableList(windows);
×
76
        }
77

78
        @Override
79
        public Map<String, Object> asMap(boolean full) {
80
            return unmodifiableMap(JvmOptions.this.asMap(full));
×
81
        }
82
    };
83

84
    public org.jreleaser.model.api.common.JvmOptions asImmutable() {
85
        return immutable;
×
86
    }
87

88
    @Override
89
    public void merge(JvmOptions source) {
90
        setUniversal(merge(this.universal, source.universal));
1✔
91
        setUnix(merge(this.unix, source.unix));
1✔
92
        setLinux(merge(this.linux, source.linux));
1✔
93
        setOsx(merge(this.osx, source.osx));
1✔
94
        setWindows(merge(this.windows, source.windows));
1✔
95
    }
1✔
96

97
    public void merge(Set<String> source) {
98
        this.universal.addAll(source);
1✔
99
    }
1✔
100

101
    public List<String> getUniversal() {
102
        return universal;
1✔
103
    }
104

105
    public void setUniversal(List<String> universal) {
106
        this.universal.clear();
1✔
107
        this.universal.addAll(universal);
1✔
108
    }
1✔
109

110
    public List<String> getUnix() {
111
        return unix;
1✔
112
    }
113

114
    public void setUnix(List<String> unix) {
115
        this.unix.clear();
1✔
116
        this.unix.addAll(unix);
1✔
117
    }
1✔
118

119
    public List<String> getLinux() {
120
        return linux;
1✔
121
    }
122

123
    public void setLinux(List<String> linux) {
124
        this.linux.clear();
1✔
125
        this.linux.addAll(linux);
1✔
126
    }
1✔
127

128
    public List<String> getOsx() {
129
        return osx;
1✔
130
    }
131

132
    public void setOsx(List<String> osx) {
133
        this.osx.clear();
1✔
134
        this.osx.addAll(osx);
1✔
135
    }
1✔
136

137
    public List<String> getWindows() {
138
        return windows;
1✔
139
    }
140

141
    public void setWindows(List<String> windows) {
142
        this.windows.clear();
1✔
143
        this.windows.addAll(windows);
1✔
144
    }
1✔
145

146
    public boolean isSet() {
147
        return
×
148
            !universal.isEmpty() ||
×
149
                !unix.isEmpty() ||
×
150
                !linux.isEmpty() ||
×
151
                !osx.isEmpty() ||
×
152
                !windows.isEmpty();
×
153
    }
154

155
    public List<String> getResolvedUniversal(JReleaserContext context) {
156
        TemplateContext props = context.fullProps();
1✔
157

158
        return universal.stream()
1✔
159
            .map(option -> resolveTemplate(context.getLogger(), option, props))
1✔
160
            .map(option -> option.replace(lineSeparator(), ""))
1✔
161
            .collect(toList());
1✔
162
    }
163

164
    public List<String> getResolvedUnix(JReleaserContext context) {
165
        TemplateContext props = context.fullProps();
1✔
166

167
        return unix.stream()
1✔
168
            .map(option -> resolveTemplate(context.getLogger(), option, props))
1✔
169
            .collect(toList());
1✔
170
    }
171

172
    public List<String> getResolvedLinux(JReleaserContext context) {
173
        TemplateContext props = context.fullProps();
1✔
174

175
        return linux.stream()
1✔
176
            .map(option -> resolveTemplate(context.getLogger(), option, props))
1✔
177
            .collect(toList());
1✔
178
    }
179

180
    public List<String> getResolvedOsx(JReleaserContext context) {
181
        TemplateContext props = context.fullProps();
1✔
182

183
        return osx.stream()
1✔
184
            .map(option -> resolveTemplate(context.getLogger(), option, props))
1✔
185
            .collect(toList());
1✔
186
    }
187

188
    public List<String> getResolvedWindows(JReleaserContext context) {
189
        TemplateContext props = context.fullProps();
×
190

191
        return windows.stream()
×
NEW
192
            .map(option -> resolveTemplate(context.getLogger(), option, props))
×
193
            .collect(toList());
×
194
    }
195

196
    @Override
197
    public Map<String, Object> asMap(boolean full) {
198
        Map<String, Object> map = new LinkedHashMap<>();
1✔
199
        map.put("universal", universal);
1✔
200
        map.put("unix", unix);
1✔
201
        map.put("linux", linux);
1✔
202
        map.put("osx", osx);
1✔
203
        map.put("windows", windows);
1✔
204
        return map;
1✔
205
    }
206
}
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