Search in sources :

Example 1 with JReleaserLogger

use of org.jreleaser.util.JReleaserLogger in project jreleaser by jreleaser.

the class AbstractJReleaserMojo method createContext.

protected JReleaserContext createContext() throws MojoExecutionException {
    try {
        if (isQuiet()) {
            System.setProperty(JRELEASER_QUIET, "true");
        }
        JReleaserLogger logger = getLogger();
        PlatformUtils.resolveCurrentPlatform(logger);
        Path basedir = resolveBasedir();
        logger.info("JReleaser {}", JReleaserVersion.getPlainVersion());
        JReleaserVersion.banner(logger.getTracer());
        if (null != configFile) {
            logger.info("Configuring with {}", configFile.getAbsolutePath());
        }
        logger.increaseIndent();
        logger.info("- basedir set to {}", basedir.toAbsolutePath());
        logger.decreaseIndent();
        return ContextCreator.create(logger, resolveConfigurer(configFile), getMode(), null == configFile ? convertModel() : readModel(logger), basedir, outputDirectory.toPath(), dryrun, gitRootSearch, collectSelectedPlatforms());
    } catch (JReleaserException e) {
        throw new MojoExecutionException("JReleaser for project " + project.getArtifactId() + " has not been properly configured.", e);
    }
}
Also used : Path(java.nio.file.Path) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) JReleaserLogger(org.jreleaser.util.JReleaserLogger) JReleaserException(org.jreleaser.util.JReleaserException)

Example 2 with JReleaserLogger

use of org.jreleaser.util.JReleaserLogger in project jreleaser by jreleaser.

the class ClientUtils method builder.

public static Feign.Builder builder(JReleaserLogger logger, int connectTimeout, int readTimeout) {
    requireNonNull(logger, "'logger' must not be null");
    Feign.Builder builder = Feign.builder();
    if (Boolean.getBoolean("jreleaser.disableSslValidation")) {
        logger.warn(RB.$("warn_ssl_disabled"));
        builder = builder.client(new Client.Default(nonValidatingSSLSocketFactory(), new NonValidatingHostnameVerifier()));
    }
    return builder.encoder(new FormEncoder(new JacksonEncoder())).decoder(new JacksonDecoder()).requestInterceptor(template -> template.header("User-Agent", "JReleaser/" + JReleaserVersion.getPlainVersion())).errorDecoder((methodKey, response) -> new RestAPIException(response.request(), response.status(), response.reason(), response.headers())).options(new Request.Options(connectTimeout, TimeUnit.SECONDS, readTimeout, TimeUnit.SECONDS, true));
}
Also used : JReleaserModelPrinter(org.jreleaser.model.JReleaserModelPrinter) HttpURLConnection(java.net.HttpURLConnection) X509Certificate(java.security.cert.X509Certificate) SSLContext(javax.net.ssl.SSLContext) URL(java.net.URL) TrustManager(javax.net.ssl.TrustManager) Client(feign.Client) MediaType(org.apache.tika.mime.MediaType) StringUtils.isNotBlank(org.jreleaser.util.StringUtils.isNotBlank) JReleaserLogger(org.jreleaser.util.JReleaserLogger) UploadException(org.jreleaser.model.uploader.spi.UploadException) SSLSession(javax.net.ssl.SSLSession) Map(java.util.Map) Objects.requireNonNull(java.util.Objects.requireNonNull) JacksonDecoder(feign.jackson.JacksonDecoder) HostnameVerifier(javax.net.ssl.HostnameVerifier) Path(java.nio.file.Path) OutputStream(java.io.OutputStream) Constants(org.jreleaser.util.Constants) Files(java.nio.file.Files) UTF_8(java.nio.charset.StandardCharsets.UTF_8) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) FormEncoder(feign.form.FormEncoder) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) IOException(java.io.IOException) Reader(java.io.Reader) Feign(feign.Feign) InputStreamReader(java.io.InputStreamReader) SSLSocketFactory(javax.net.ssl.SSLSocketFactory) TimeUnit(java.util.concurrent.TimeUnit) IOUtils(org.apache.commons.io.IOUtils) AnnounceException(org.jreleaser.model.announcer.spi.AnnounceException) JReleaserVersion(org.jreleaser.model.JReleaserVersion) JacksonEncoder(feign.jackson.JacksonEncoder) X509TrustManager(javax.net.ssl.X509TrustManager) FormData(feign.form.FormData) Tika(org.apache.tika.Tika) Request(feign.Request) RB(org.jreleaser.bundle.RB) Feign(feign.Feign) Request(feign.Request) JacksonEncoder(feign.jackson.JacksonEncoder) FormEncoder(feign.form.FormEncoder) JacksonDecoder(feign.jackson.JacksonDecoder)

Aggregations

Path (java.nio.file.Path)2 JReleaserLogger (org.jreleaser.util.JReleaserLogger)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Client (feign.Client)1 Feign (feign.Feign)1 Request (feign.Request)1 FormData (feign.form.FormData)1 FormEncoder (feign.form.FormEncoder)1 JacksonDecoder (feign.jackson.JacksonDecoder)1 JacksonEncoder (feign.jackson.JacksonEncoder)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 OutputStream (java.io.OutputStream)1 Reader (java.io.Reader)1 HttpURLConnection (java.net.HttpURLConnection)1 URL (java.net.URL)1 UTF_8 (java.nio.charset.StandardCharsets.UTF_8)1 Files (java.nio.file.Files)1 X509Certificate (java.security.cert.X509Certificate)1