Grab Dependency Populator

Maven extension to scan a path for @Grab annotations and add them to the project dependencies

License

License

APLv2.0
Categories

Categories

Maven Build Tools
GroupId

GroupId

org.goots.maven.extensions
ArtifactId

ArtifactId

grab-dependency-populator
Last Version

Last Version

1.3
Release Date

Release Date

Type

Type

jar
Description

Description

Grab Dependency Populator
Maven extension to scan a path for @Grab annotations and add them to the project dependencies
Project URL

Project URL

http://github.com/rnc/alt-deploy-maven-extension
Source Code Management

Source Code Management

http://github.com/rnc/grab-dependency-populator

Download grab-dependency-populator

How to add to project

<!-- https://jarcasting.com/artifacts/org.goots.maven.extensions/grab-dependency-populator/ -->
<dependency>
    <groupId>org.goots.maven.extensions</groupId>
    <artifactId>grab-dependency-populator</artifactId>
    <version>1.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.goots.maven.extensions/grab-dependency-populator/
implementation 'org.goots.maven.extensions:grab-dependency-populator:1.3'
// https://jarcasting.com/artifacts/org.goots.maven.extensions/grab-dependency-populator/
implementation ("org.goots.maven.extensions:grab-dependency-populator:1.3")
'org.goots.maven.extensions:grab-dependency-populator:jar:1.3'
<dependency org="org.goots.maven.extensions" name="grab-dependency-populator" rev="1.3">
  <artifact name="grab-dependency-populator" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.goots.maven.extensions', module='grab-dependency-populator', version='1.3')
)
libraryDependencies += "org.goots.maven.extensions" % "grab-dependency-populator" % "1.3"
[org.goots.maven.extensions/grab-dependency-populator "1.3"]

Dependencies

compile (5)

Group / Artifact Type Version
org.commonjava.maven.atlas : atlas-identities jar 0.17.1
org.commonjava.maven.ext : pom-manipulation-common jar 3.8.1
com.fasterxml.jackson.dataformat : jackson-dataformat-xml jar 2.10.3
com.fasterxml.jackson.core : jackson-annotations jar 2.10.3
com.fasterxml.jackson.core : jackson-databind jar 2.10.3

provided (5)

Group / Artifact Type Version
org.projectlombok : lombok jar 1.18.10
javax.inject : javax.inject jar 1
org.apache.maven : maven-core jar 3.3.1
org.apache.maven : maven-model jar 3.3.1
org.slf4j : slf4j-api jar 1.7.25

test (7)

Group / Artifact Type Version
org.apache.maven : apache-maven zip 3.3.1
ch.qos.logback : logback-classic jar 1.2.3
ch.qos.logback : logback-core jar 1.2.3
junit : junit jar 4.12
com.github.stefanbirkner : system-rules jar 1.18.0
org.codehaus.groovy : groovy-all jar 2.4.8
org.apache.ivy : ivy jar 2.4.0

Project Modules

There are no modules declared in this project.

Build Status (Travis CI)

Maven extension to add dependencies and repositories specified in Grape @Grab/@GrabResolver annotations.

Overview

This extension will activate implicitly once configured. It will scan the source recursively for *.groovy files and locate any @Grab annotations (i.e. @Grab and @GrabResolver). These will be parsed and the resulting dependencies and repositories added to the Maven project dependencies.

Installation

It is recommended to install this as a Core Extension (See here). Further details on this extension method may be found in Using Maven 3 lifecycle extension and Maven 3.3.1 Release Notes

A typical extension file is:

<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
  <extension>
    <groupId>org.goots.maven.extensions</groupId>
    <artifactId>grab-dependency-populator</artifactId>
    <version>1.0</version>
  </extension>
</extensions>

It may also be installed in <maven-installation>/lib/ext using the jar-with-dependencies version.

Configuration

The following configuration options are available:

Config Property Default Description
grabPopulatorDisable false Disables the extension
grabPopulatorAddAtEnd true Add the 'grabbed' dependencies at the end of the list
grabPopulatorErrorOnMismatch true Throws an error if multiple @Grab have the same groupId / artifactId but differing versions
grabPopulatorVerifyDependencies true Checks that all no grabbed dependency has a different version to native dependencies

The extension can be configured in two different ways:

XML File

An xml file, named as grabDependencyPopulator.xml may be placed within <project>/.mvn. It may contain:

<?xml version="1.0" encoding="utf-8"?>

<configuration>
  <errorOnMismatch>true</errorOnMismatch>
  <verifyDependencies>false</verifyDependencies>
  <atEnd>false</atEnd>
  <include>
    <directory>src</directory>
    <directory>vars</directory>
  </include>
</configuration>

The 'include/directory' denotes a list of directories the extension will start searching from. If it is not included then the tool will search all directories from the root (excluding target build directories).

Properties

The extension will also check system properties (using the naming in the table above) that are available within Maven.

Versions

Version
1.3
1.2
1.1
1.0