Hi,
I think you did some mistake somewhere, because it seems to work on my side. I setup a maven repo with docker:
version: "3"
volumes:
nexus: {}
services:
nexus:
image: sonatype/nexus3:3.5.0
container_name: nexus
ports:
- "8081:8081"
volumes:
- nexus:/nexus-data
Start it with docker-compose up -d
Upload a project named foo with:
apply plugin: 'java'
apply plugin: 'maven-publish'
group = 'foo'
version = '1'
publishing {
publications {
fooLib(MavenPublication) {
from components.java
}
}
repositories {
maven {
url "http://localhost:8081/repository/maven-${version.endsWith('-SNAPSHOT') ? 'snapshots' : 'releases'}"
credentials {
username = 'admin'
password = 'admin123'
}
}
}
}
Create a multi-project with 2 subprojects: priv and pub.
// rootProject build.gradle
subprojects {
apply plugin: 'java'
repositories {
mavenCentral()
}
test {
testLogging {
events 'passed', 'skipped', 'failed'
}
}
}
In pub, create a unit test asserting that true is true.
// pub build.gradle
dependencies {
testCompile 'junit:junit:4.12'
}
In priv, test a class packaged in foo:
// priv build.gradle
repositories {
maven {
url 'http://localhost:8081/repository/maven-public/'
}
}
dependencies {
compile 'foo:foo:1'
testCompile 'junit:junit:4.12'
}
Build the project:
me@here:/tmp/foo/consume$ gradle test
Download http://localhost:8081/repository/maven-public/foo/foo/1/foo-1.pom
Download http://localhost:8081/repository/maven-public/foo/foo/1/foo-1.jar
> Task :priv:test
FooTest > should_access_foo PASSED
> Task :pub:test
TrueTest > should_be_true PASSED
BUILD SUCCESSFUL in 3s
You probably made some typo somewhere else in your project configuration.