I followed the instructions at Maven Publish Plugin to enable publishing to my local Nexus server.
In the build.gradle this works:
apply plugin: 'maven-publish'
publishing {
repositories {
maven {
url "localhost:8081/repository/myRepository/"
}
}
}
But I don’t want to put the reference to my local repository in project code that will be committed.
If I move the code into init.gradle I get this error:
A problem occurred evaluating initialization script.
Failed to apply plugin [id ‘org.gradle.maven-publish’]
Cannot apply model rules of plugin ‘org.gradle.api.publish.maven.plugins.MavenPublishPlugin’ as the target ‘build’ is not model rule aware
Should this work?
If so, what is missing from init.gradle?