• 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

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

20
import org.apache.commons.jexl3.JexlBuilder;
21
import org.apache.commons.jexl3.JexlContext;
22
import org.apache.commons.jexl3.JexlEngine;
23
import org.apache.commons.jexl3.JexlException;
24
import org.apache.commons.jexl3.JexlFeatures;
25
import org.apache.commons.jexl3.JexlInfo;
26
import org.apache.commons.jexl3.JexlScript;
27
import org.apache.commons.jexl3.MapContext;
28
import org.jreleaser.bundle.RB;
29
import org.jreleaser.model.JReleaserException;
30
import org.jreleaser.mustache.Templates;
31

32
/**
33
 * @author Andres Almiray
34
 * @since 1.6.0
35
 */
36
public final class JReleaserScriptEvaluator {
37
    private final JexlEngine jexl;
38

39
    public JReleaserScriptEvaluator() {
1✔
40
        jexl = new JexlBuilder()
1✔
41
            .features(new JexlFeatures()
1✔
42
                .annotation(false)
1✔
43
                .importPragma(false)
1✔
44
                .lambda(false)
1✔
45
                .loops(false)
1✔
46
                .namespacePragma(false)
1✔
47
                .newInstance(false)
1✔
48
                .pragma(false)
1✔
49
                .pragmaAnywhere(false)
1✔
50
                .sideEffect(false)
1✔
51
                .sideEffectGlobal(false))
1✔
52
            .create();
1✔
53
    }
1✔
54

55
    public Object eval(JReleaserContext context, String scriptText) {
56
        try {
NEW
57
            scriptText = Templates.resolveTemplate(context.getLogger(), scriptText, context.props());
×
58
            JexlScript script = jexl.createScript(new JexlInfo("script", 0, 0), scriptText);
×
59
            JexlContext ctxt = new MapContext();
×
60
            ctxt.set("context", context.asImmutable());
×
61
            return script.execute(ctxt);
×
62
        } catch (JexlException.Parsing e) {
×
63
            throw new JReleaserException(RB.$("ERROR_script_parse", e.getMessage()));
×
64
        } catch (JexlException e) {
×
65
            throw new JReleaserException(RB.$("ERROR_script_execution", e.getMessage()));
×
66
        }
67
    }
68
}
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