Pushing my first artifact

Thank you for reading. I am in the process of pushing build file to a remote nexus repository. I have followed the instructions by nana from her devops bootcamp.

When I type ./gradlew publish i dont see the jar file being pushed into the remote repo.

this is build file code

plugins {
id ‘java’
id ‘org.springframework.boot’ version ‘2.2.2.RELEASE’
id ‘io.spring.dependency-management’ version ‘1.0.8.RELEASE’

group ‘com.example’
version ‘1.0-SNAPSHOT’

sourceCompatibility = 1.8

apply plugin: ‘maven-publish’

publishing {
publications {
maven(MavenPublication) {
artifact(“build/libs/my-app-$version”+“.jar”) {
extension ‘jar’

repositories {
    maven {
        name 'nexus'
        url ""
        credentials {
            username project.repoUser
            password project.repoPassword


repositories {

dependencies {
implementation ‘org.springframework.boot:spring-boot-starter-web’
implementation group: ‘net.logstash.logback’, name: ‘logstash-logback-encoder’, version: ‘5.2’
testImplementation group: ‘junit’, name: ‘junit’, version: ‘4.12’

When I check the nexus repo I dont see no files uploaded?

The repositories block for publication needs to be in the publishing block.
You declare the repository as normal repository for resolving dependencies.
If you need it for both, you need to declare it in both.

Besides that, some sidenotes:

  • Do not use the Spring dependency management plugin, it is just a relict from former times and should not be used anymore, even its maintainer says that, use the built-in BOM support using platform(...) instead.
  • Do not apply plugins using apply in a build script, use the plugins { ... } block unless you have a very good reason (outdated tutorials are not :-D)
  • Do not declare the artifact to be published manually, declare the Java component to be published as shown in the Gradle documentation