I have a gradle multimodule project using the maven publish plugin. The publish task fails as the maven publish plugin generates an invalid POM.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xmlns="http://www.w3.org/2000/xmlns/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xmlns="http://www.w3.org/2000/xmlns/">
<modelVersion xmlns="http://maven.apache.org/POM/4.0.0">4.0.0</modelVersion>
<groupId xmlns="http://maven.apache.org/POM/4.0.0">com.example</groupId>
<artifactId xmlns="http://maven.apache.org/POM/4.0.0">application</artifactId>
<version xmlns="http://maven.apache.org/POM/4.0.0">0.2.0-SNAPSHOT</version>
<packaging xmlns="http://maven.apache.org/POM/4.0.0">pom</packaging>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.2.1.RELEASE</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
</project xmlns="http://maven.apache.org/POM/4.0.0">
It clearly is invalid as there are duplicated attributes in the project starting element and the closing element has 'xmlns="http://maven.apache.org/POM/4.0.0"'
I tried gradle 5.6.0 and 6.1.1 with the same outcome.
Any idea how to fix this and what could be the cause?