in build.gradle in your project:
to publish:
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = artifactName
from components.java
}
}
repositories {
maven {
name = "NexusRemote"
url = "http://domain.com:8081/repository/maven-releases/"
allowInsecureProtocol = true // Required if you are not using HTTPS locally
credentials {
username = env.getProperty("NEXUS_USERNAME")
password = env.getProperty("NEXUS_PASSWORD")
}
}
}
need a .env file with environment variables & www. is a subdomain

// to consume:
repositories {
mavenCentral()
maven {
name = "NexusRemote"
url = "http://domain.com:8081/repository/maven-releases/"
allowInsecureProtocol = true // Required if you are not using HTTPS locally
credentials {
username = env.getProperty("NEXUS_USERNAME")
password = env.getProperty("NEXUS_PASSWORD")
}
}
}