jinnovations/attribution-maven-plugin


Maven plugin for generating an xml file, containing information about a project's dependencies.

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.jinnovations:attribution-maven-plugin:-SNAPSHOT'
	}
	dependencies {
		implementation("com.github.jinnovations:attribution-maven-plugin:-SNAPSHOT")
	}
	<dependency>
	    <groupId>com.github.jinnovations</groupId>
	    <artifactId>attribution-maven-plugin</artifactId>
	    <version>-SNAPSHOT</version>
	</dependency>

                            
    libraryDependencies += "com.github.jinnovations" % "attribution-maven-plugin" % "-SNAPSHOT"
        
        

                            
    :dependencies [[com.github.jinnovations/attribution-maven-plugin "-SNAPSHOT"]]
        
        

Readme


Attribution Maven Plugin

Maven Central

Javadocs

The Attribution Maven Plugin is a tool for producing information about a project's dependencies, in a way that can be consumed by external reporting tools. It currently leverages the Maven Project Info Reports Plugin (https://maven.apache.org/components/plugins/maven-project-info-reports-plugin/) to obtain all of a project's data, and then outputs the information to an XML file, such as: target/attribution.xml.

This plugin came out of the need to get some of the same information produced by the Maven Project Info Reports Plugin, and have it transformed, ready to be consumed by tools which may require input in a certain format, such as a CSV. By producing an attribution XML file, scripts can be created to translate the data into these other consumable formats.

Configuration

  • outputFile
    • Location of the output attribution XML file (defaults to target/attribution.xml)
  • forceRegeneration
    • Whether or not regeneration of the attribution.xml file should be forced (defaults to false). Normally, if the plugin detects the timestamp of the attribution.xml file is later than the project's pom.xml file, it will not go through the process of regenerating it. This parameter will cause it to be regenerated, regardless of file timestamps.
  • dependencyOverrides
    • Provides one or more <dependencyOverride> elements, which allow you to override values placed in the final attribution.xml file. This feature is handy when for some reason a dependency doesn't contain certain pieces of information in its pom. See the example below for how this is specified.
  • skipDownloadUrl
    • This flag allows to skip the retrieval of the downloadUrl info (defaults to false). It can highly reduce the run time of the plugin if this info is not relevant as this part is quite time consuming.
  • includeTransitiveDependencies
    • Whether or not transitive dependencies should be included in the report (defaults to true). Setting it to false will include only the project dependencies.
  • threads
    • Number of concurrent thread tasks used to resolve the maven dependencies (defaults to 10).
  • skip
    • If true, no action will take place by the plugin (defaults to false).

Example

<plugin>
    <groupId>com.github.jinnovations</groupId>
    <artifactId>attribution-maven-plugin</artifactId>
    <version>${attribution-maven-plugin.version}</version>
    <executions>
        <execution>
            <goals>
                <goal>generate-attribution-file</goal>
            </goals>
            <phase>generate-resources</phase>
        </execution>
    </executions>
    <configuration>
        <outputFile>${project.build.directory}/attribution.xml</outputFile>
        <dependencyOverrides>
            <dependencyOverride>
                <forDependency>org.apache.axis:axis</forDependency>
                <projectUrl>https://axis.apache.org/axis/</projectUrl>
                <license>
                    <name>Apache License, Version 2.0</name>
                    <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
                </license>
            </dependencyOverride>
            <dependencyOverride>
                <forDependency>net.iharder:base64</forDependency>
                <license>
                    <name>Public Domain (any license you desire)</name>
                    <url>http://iharder.sourceforge.net/current/java/base64/</url>
                </license>
            </dependencyOverride>
            <dependencyOverride>
                <forDependency>javax.xml:jaxrpc-api</forDependency>
                <projectUrl>https://java.net/projects/jax-rpc/</projectUrl>
                <license>
                    <name>CDDL-1.0</name>
                    <url>https://opensource.org/licenses/cddl1.php</url>
                </license>
            </dependencyOverride>
            <dependencyOverride>
                <forDependency>org.hamcrest:hamcrest-core</forDependency>
                <projectUrl>http://hamcrest.org/JavaHamcrest/</projectUrl>
            </dependencyOverride>
        </dependencyOverrides>
    </configuration>
</plugin>