All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.gitlab.jaxsonp.openapipublish.maven.OpenAPIPublishMojo.kt Maven / Gradle / Ivy

There is a newer version: 0.2.0-RC3
Show newest version
/**
 * Copyright 2023 Jack Perry
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.gitlab.jaxsonp.openapipublish.maven

import io.gitlab.jaxsonp.openapipublish.core.publishers.GenericHttpPublisher
import org.apache.maven.plugin.AbstractMojo
import org.apache.maven.plugins.annotations.LifecyclePhase
import org.apache.maven.plugins.annotations.Mojo
import org.apache.maven.plugins.annotations.Parameter
import java.net.URI

@Mojo(name = "openapi-publish", defaultPhase = LifecyclePhase.DEPLOY)
class OpenAPIPublishMojo : AbstractMojo() {

    @Parameter(required = true)
    lateinit var apiDir: String
    @Parameter
    var apiVersion: String? = null
    @Parameter(required = true)
    lateinit var destinationURI: URI
    @Parameter
    var registryAuthHeaders: Map? = null
    @Parameter
    var filePrefix: String? = null
    @Parameter
    var fileSuffix: String? = null
    @Parameter
    var httpMethod: String? = null

    override fun execute() {
        GenericHttpPublisher(
            apiDir = apiDir,
            apiVersion = apiVersion,
            destinationUri = destinationURI,
            filePrefix = filePrefix,
            fileSuffix = fileSuffix,
            authHeaders = registryAuthHeaders,
            httpMethod = httpMethod,
        ).publish()
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy