I see in my jar that we have META-INF/DEPENDENCIES file.
// ------------------------------------------------------------------
// Transitive dependencies of this project determined from the
// maven pom organized by organization.
// ------------------------------------------------------------------
htrace-core4
From: 'FasterXML' (http://fasterxml.com/)
- Jackson-annotations (http://wiki.fasterxml.com/JacksonHome) com.fasterxml.jackson.core:jackson-annotations:bundle:2.4.0
License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
- Jackson-core (http://wiki.fasterxml.com/JacksonHome) com.fasterxml.jackson.core:jackson-core:bundle:2.4.0
License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
- jackson-databind (http://wiki.fasterxml.com/JacksonHome) com.fasterxml.jackson.core:jackson-databind:bundle:2.4.0
License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
From: 'The Apache Software Foundation' (http://www.apache.org/)
- Commons Logging (http://commons.apache.org/logging) commons-logging:commons-logging:jar:1.1.1
License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
My question is
What is this file and what does its content add for my jar?
It is an Apache specific file that documents the JAR file's transitive dependencies on other JAR files. It also lists their licenses.
According to the Maven documentation:
"Maven project provides a set of resources to help you build Java resources compliant with Apache rules."
... and this file is one of the files that is generated. I've not been able to find a link that sets out the "Apache rules" that the above quote refers to. (If you can find a link, please comment!)
The "META-INF/DEPENDENCIES" file is not mentioned in the official OpenJDK JAR file specification.
How its created ? How do we indicate in our maven jar build that we want to create this file?
It is generated using Maven's "maven-remote-resources-plugin". Here is an example config taken from the Apache Maven documentation:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-remote-resources-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<resourceBundles>
<!-- Will generate META-INF/DEPENDENCIES META-INF/LICENSE META-INF/NOTICE -->
<resourceBundle>org.apache.apache.resources:apache-jar-resource-bundle:1.5-SNAPSHOT</resourceBundle>
<!-- Will generate META-INF/DEPENDENCIES.txt META-INF/LICENSE.txt META-INF/NOTICE.txt -->
<resourceBundle>org.apache.apache.resources:apache-jar-txt-resource-bundle:1.5-SNAPSHOT</resourceBundle>
<!-- Will generate META-INF/DISCLAIMER -->
<resourceBundle>org.apache.apache.resources:apache-incubator-disclaimer-resource-bundle:1.2-SNAPSHOT</resourceBundle>
</resourceBundles>
</configuration>
</execution>
</executions>
</plugin>
This can be added in the appropriate point in your project's POM file.
For more information, see the Apache Resource Bundles page in the Apache Maven documentation.