This situation came up when I was attempting to change the repository that a maven publication is published to after it had been configured by a plugin to a default location
build.gradle
apply plugin: 'maven-publish'
apply plugin: 'java'
group 'buildteam.test'
version '1.0.1'
// This is simulating the plugin
publishing {
publications {
javaCode ( MavenPublication ) {
from components.java
}
}
repositories {
mavenLocal()
}
}
// Changing it inside of the build.gradle away from default
publishing.repositories {
mavenLocal()
}
/* **COMMENTED OUT BLOCK**
publishing{
repositories {
mavenLocal()
}
}
*/
dependencies {
compile group: 'org.jmock', name: 'jmock', version: '2.6.0'
}
repositories {
mavenCentral()
}
When ran with the commented out block in place and the publishing.repositories block commented out the code behaves as expected and generates
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.
0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>buildteam.test</groupId>
<artifactId>companyArtifactName</artifactId>
<version>1.0.0</version>
<dependencies>
<dependency>
<groupId>org.jmock</groupId>
<artifactId>jmock</artifactId>
<version>2.6.0</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>
However when ran as listed it generates
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.
0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>buildteam.test</groupId>
<artifactId>pason-ui</artifactId>
<version>1.0.1</version>
</project>
I am posting to check if this is intended behavior or a new/already discovered bug.
Thanks,
Jamie