How to script Gradle in order to publish shadowjar into Artifactory

后端 未结 7 643
南笙
南笙 2021-01-11 11:33

I am using shadowJar in my java project. I would like to push the outcome into artifactory.

My gradle script look like this, I am not sure how to connect the dots:

7条回答
  •  误落风尘
    2021-01-11 12:10

    The API has changed in the shadow plugin, this works for me with com.github.jengelman.gradle.plugins:shadow:2.0.1: http://imperceptiblethoughts.com/shadow/#publishing_shadow_jars

    5. Publishing Shadow JARs
    5.1. Publishing with Maven-Publish Plugin
    The Shadow plugin will automatically configure the necessary tasks 
    in the presence of Gradle’s maven-publish plugin. The plugin provides
    the component method from the shadow extension to configure the 
    publication with the necessary artifact and dependencies in the 
    POM file.
    
    Publishing a Shadow JAR with the Maven-Publish Plugin
    apply plugin: 'java'
    apply plugin: 'maven-publish'
    apply plugin: 'com.github.johnrengelman.shadow'
    
    publishing {
      publications {
        shadow(MavenPublication) { publication ->
          project.shadow.component(publication)
        }
      }
      repositories {
        maven {
          url "http://repo.myorg.com"
        }
      }
    }
    

提交回复
热议问题