Publishing to Nexus via maven publish (but still using gradle)

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

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

publishing {
publications {
maven(MavenPublication) {
groupId = ‘com.example’
artifactId = ‘my-app’
version = ‘1.0-SNAPSHOT’
from components.java
}
}

repositories {
    maven {
        url "http://167.99.236.170:8081/maven-snapshots/"
        credentials {
            username project.repoUser
            password project.repoPassword
            allowInsecureProtocol = true
        }
    }
}

}

sourceCompatibility = 1.8

repositories {
mavenCentral()
}

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’
}

Nexus 3 URLs use the structure http(s)://{hostname}/repository/{repositoryname}

1 Like

I have to create a reverse DNS entry for this to work?

http://167.99.236.170:8081/repository/maven-snapshots/
like that?


new error

This is not a Nexus error. There’s an issue in your Gradle build. Why are you specifying groupId, artifactId, and version within the maven publication block instead of allowing Gradle to do this for you implicitly via project properties? See Maven Publish Plugin.

The error says your build does not produce the artifact you’re trying to publish.

1 Like