0
votes

I would like to document in the shaded jar what maven artifacts actually end up in that shaded jar.

All the packages get merged and that makes it difficult to workout exactly what artifacts went into it just by looking at the jar.

I suppose the ideal place for that information would be the manifest file but it could just be in a text file.

Ideally I want to see groupId, artifactId and version.

Is this at all possible with the maven shade plugin?

Thanks in advance, Phil.

3
It's unlikely you can get this kind of information from anything other than the shade plugin itself. So I would look into its configuration properties. For example there's option createDependencyReducedPom which can be combined with keepDependenciesWithProvidedScope to get a modified pom.xml with included dependencies marked with provided scope. I don't see a way to differentiate them from originally provided dependencies, though. - Anton Koscejev

3 Answers

0
votes

You can do this with maven, below steps to follow:

1- Create under src/main/resources a file wich will contain the information, information.txt for example with the following content:

version=${project.version}
artifactId=${project.artifactId}
groupId=${project.groupId}

2- Activate Maven filtring

 <project>
      ...
      <build>
        ...
        <resources>
          <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
            <includes>
                <include>**/information.txt</include>
            </includes>
          </resource>
          ...
        </resources>
        ...
      </build>
      ...
    </project>

3- Build your project. The file will contain now the information you need.

More information about the plugin.

0
votes

As it doesn't like this is supported by the shade plugin i have requested this feature. https://issues.apache.org/jira/browse/MSHADE-236

0
votes

When building jars with Maven, by default you will get the following entries: /META-INF/maven/${groupId}/${artifactId}/pom.properties and /META-INF/maven/${groupId}/${artifactId}/pom.xml. When shading, all these files will also end up in the shaded jar.