Home > OS >  gradle publishing project-version-PLAIN.war file instead of project-version.war
gradle publishing project-version-PLAIN.war file instead of project-version.war

Time:12-08

When I run "gradle build", it generates a build/libs/project-version.war file which is able to run by itself with "java -jar" command. But when I run "gradle artifactoryPublish", it saves on the artifactory repository a "project-version-plain-war" file which does not have tomcat embedded.

I am following this instruccions https://www.jfrog.com/confluence/display/JFROG/Gradle Artifactory Plugin

The lines added to the gradle.build are something like this:

plugin "maven-publish"
plugin "com.jfrog.artifactory"
artifactory { 
...
}

subprojects {
  plugin "war"
  group = group
  version = version

  publishing {
    publications {
      MavenPublication(MavenPublication) {
        from components.web
      }
    }
    repositories{
      maven { url "https://artifactory-server" }
    }
  }
}

help is appreciated

CodePudding user response:

Using from components.web means that you are publishing the artifact produced by the war task. You need to publish the artifact produced by the bootWar task. You can do so by changing the publication to use artifact bootWar instead:

publishing {
  publications {
    MavenPublication(MavenPublication) {
      artifact bootWar
    }
  }
  repositories{
    maven { url "https://artifactory-server" }
  }
}

This is described in the reference documentation for Spring Boot's Gradle plugin.

  • Related