How to generate default META-INF/maven files

I’m writing a custom Gradle plugin to replace an existing Maven plugin. I’m comparing the results from the Maven build with the corresponding Gradle build. About the only difference left is that the resulting Maven jar file has a “META-INF/maven” folder, with generated “pom.xml” and “” files (and intervening folders for group & artifact).

I know this is related to the “maven” and “maven-publish” plugins, but I could use a succinct explanation of how (and whether) I should get these files into the resulting jar, using as many defaults as possible.

I’ve looked at the “Maven” and “Maven Publish” chapters in the User Guide, but I could use more contextual background on this problem.

Neither the ‘maven’ nor ‘maven-publish’ plugins currently do this. As for “whether” this should be done, if consumers of your artifact are retrieving it from a Maven repository, I see no reason why the POM needs to be bundled in the JAR itself.

That last point is what I needed to know. If this is unnecessary metadata, then I’ll skip it.