• 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

0.0
/plugins/jdks-maven-plugin/src/main/java/org/jreleaser/jdks/maven/plugin/AbstractDiscoMojo.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.jdks.maven.plugin;
19

20
import org.apache.maven.execution.MavenSession;
21
import org.apache.maven.plugin.BuildPluginManager;
22
import org.apache.maven.plugin.MojoExecutionException;
23
import org.apache.maven.plugin.MojoFailureException;
24
import org.apache.maven.plugins.annotations.Component;
25
import org.apache.maven.plugins.annotations.Parameter;
26
import org.jreleaser.sdk.disco.Disco;
27
import org.jreleaser.util.Errors;
28

29
import java.io.File;
30
import java.io.PrintWriter;
31
import java.io.StringWriter;
32
import java.util.List;
33

34
/**
35
 * @author Andres Almiray
36
 * @since 1.5.0
37
 */
NEW
38
abstract class AbstractDiscoMojo extends AbstractSetupMojo {
×
39
    @Parameter(required = true)
40
    protected List<Pkg> pkgs;
41

42
    @Parameter(property = "disco.output.directory", defaultValue = "${project.build.directory}/jdks")
43
    protected File outputDirectory;
44

45
    @Parameter(defaultValue = "${session}")
46
    protected MavenSession session;
47

48
    @Component
49
    protected BuildPluginManager pluginManager;
50

51
    @Parameter(property = "disco.setup.connect.timeout")
52
    protected int connectTimeout;
53

54
    @Parameter(property = "disco.setup.read.timeout")
55
    protected int readTimeout;
56

57
    /**
58
     * Skip execution.
59
     */
60
    @Parameter(property = "disco.setup.skip")
61
    protected boolean skip;
62

63
    @Override
64
    public void execute() throws MojoExecutionException, MojoFailureException {
UNCOV
65
        Banner.display(project, getLog());
×
66
        if (skip) return;
×
67

UNCOV
68
        if (null == pkgs || pkgs.isEmpty()) return;
×
UNCOV
69
        validate();
×
70

UNCOV
71
        doExecute(initializeDisco());
×
UNCOV
72
    }
×
73

74
    protected abstract void doExecute(Disco disco) throws MojoExecutionException, MojoFailureException;
75

76
    private Disco initializeDisco() throws MojoExecutionException {
77
        try {
UNCOV
78
            return new Disco(new JReleaserLoggerAdapter(getLog()), connectTimeout, readTimeout);
×
UNCOV
79
        } catch (RuntimeException e) {
×
80
            throw new MojoExecutionException("Could not initialize Disco client", e);
×
81
        }
82
    }
83

84
    private void validate() throws MojoFailureException {
UNCOV
85
        if (connectTimeout <= 0 || connectTimeout > 300) {
×
UNCOV
86
            connectTimeout = 20;
×
87
        }
88
        if (readTimeout <= 0 || readTimeout > 300) {
×
UNCOV
89
            readTimeout = 60;
×
90
        }
91

92
        Errors errors = new Errors();
×
93
        pkgs.forEach(pkg -> pkg.validate(errors));
×
94

UNCOV
95
        if (errors.hasErrors()) {
×
96
            StringWriter s = new StringWriter();
×
UNCOV
97
            PrintWriter w = new PrintWriter(s, true);
×
UNCOV
98
            errors.logErrors(w);
×
UNCOV
99
            throw new MojoFailureException(s.toString());
×
100
        }
UNCOV
101
    }
×
102
}
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