When Maven builds a JAR file, it places the module\'s POM file inside (seemingly in the directory
When I build a JAR file from A
The pom.xml
and pom.properties
files are packaged up in the JAR so that each artifact produced by Maven is self-describing and also allows you to utilize the metadata in your own application, should the need arise. One simple use might be to retrieve the version of your application.
That said, the inclusion of these files can be deactivated if desired through MavenArchiverConfiguration which admits a boolean addMavenDescriptor parameter and it's safe to not include them (even if I find it nice to have them). For example for a JAR:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
</configuration>
</plugin>
</plugins>
...
</build>
...
</project>
Regarding the location of these files, the documentation of addMavenDescriptor says:
Whether the generated archive will contain these two Maven files:
- The pom file, located in the archive in
META-INF/maven/${groupId}/${artifactId}/pom.xml
- A pom.properties file, located in the archive in
META-INF/maven/${groupId}/${artifactId}/pom.properties
The default value is true.
This should answer your question.
The pom.xml inside JAR is designed for following purposes,
I don't know if any of these features are implemented anywhere. You can ignore it for sure.