Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mebigfatguy/yank

a non transitive maven artifact fetcher for corporate environments
https://github.com/mebigfatguy/yank

3rdparty artifacts java

Last synced: about 1 month ago
JSON representation

a non transitive maven artifact fetcher for corporate environments

Awesome Lists containing this project

README

        

yank
====

a non transitive maven artifact fetcher for corporate environments.

# Maven Coordinates #
groupId: com.mebigfatguy.yank
artifactId: yank
version: 2.0.1

yank is an ant task that can retrieve maven artifacts from public and private servers, similar to maven and ivy.

However yank is meant for corporate environments where governance rules are more strict than transitive
dependency managers allow. yank only pulls down what you ask for, and the the files to be pulled are documented
in a spread sheet (xls, xlsx, ods, csv or txt files) for easy use of corporate approvals, etc.

You can add this task, as


<yank yankFile="${lib.dir}/yank.xls" destination="${lib.dir}">
<server url="https://repo1.maven.org/maven2"/>
</yank>

and it will pull new artifacts as needed. You can list as many servers as desired each in its own element.

There are a few optional attributes to the yank task that you can add as follows


Property
Description
Value
Default


failOnError
fails the build if an artifact fails to download
(true/false)
true


proxyServer
the url of the proxy server to use
(String)
blank


reportMissingDependencies
logs transitive dependencies based on the poms
(true/false)
false


findUpdatesFile
generate a file with jars that have updated versions not being used
(file)
null

source
download source artifacts as well
(true/false)
false


stripVersions
save the jar files without version numbers
(true/false)
false


separateClassifierTypes
saves sources, javadocs, and other 'classifier' type artifacts in sub directories
{true/false}
false


generateLicenses
pulls all licenses files it can find from pom files
{true/false}
false


threadPoolSize
number of concurrent download threads
(integer)
4 * numProcessors


checkSHADigests
compare provided SHA-1 digest against calculated digest
(true/false)
false

In addition, you can add a sub element to generate an ant path element, such as


<generatePath pathXmlFile="${sample.dir}/yank_build.xml" classpathName="yank.path" />

This will dynamically populate a classpath element in your project with reference 'yank.path' that can be used in tasks etc.
The pathXMLFile attribute is optional, but if specified, will also produce an ant xml project file located at
pathXmlFile (${sample.dir}/yank_build.xml) like


<path name="yank.path">
<pathelement location="${lib.dir}/asm.jar" />
</path>


With path elements for each jar specified.

You can also add a sub element to generate a properties file containing constants for all the jar version numbers, such as


<generateVersions propertyFileName="${basedir}/version.properties" />

As for the yank.xls file, the spreadsheet is just a normal spread sheet of your own design, so long as there are GroupId,
ArtifactId and Version columns. You may also specify a Classifier column, which can download jars with names after the version
such as natives. Note that sources jars are automatically handled and you need not use the classifier column for this purpose
(See the source attribute above). You may also specify a Type column to support files such as xml, or zip files, if not specified, 'jar'
is assumed. A Digest column may be added that if populated with SHA-1 digest of the jar, and the checkSHADigests attribute is set, yank
will validate that the downloaded jar has the expected digest, and if not fails the build. More columns may be added for your governance purposes,
such as license, reason, code area, etc, without issue.
If values for columns groupId or version are not filled in, the previous value is pulled down from above. Other columns must be
explicitly specified.

* Spread sheets can be defined using *.xls, *.xlsx, *.ods, csv or txt (tab delimited) formats

Here's an example yank.xls file

GroupIdArtifactIdVersionClassifierDigest
org.ow2.asmasm4.1ad568238ee36a820bd6c6806807e8a14ea34684d

org.slf4jslf4j-api1.7.56b262da268f8ad9eff941b25503a9198f0a0ac93

ch.qos.logbacklogback-core1.0.122d23694879c2c12f125dac5076bdfd5d771cc4cb
logback-classic030748760198d5071e139fa3d48cd1e57031fed6

org.jogamp.jogljogl-all2.0.2
jogl-allnatives-linux-amd64
jogl-allnatives-macosx-universal
jogl-allnatives-windows-amd64

Below is a simplistic example of a build.xml file that uses yank to manage dependencies


<project name="ty" default="jar" xmlns:yank="antlib:com.mebigfatguy.yank">
<property file="build.properties"/>
<property name="src.dir" value="${basedir}/src" />
<property name="classes.dir" value="${basedir}/classes" />
<property name="lib.dir" value="${basedir}/lib" />
<target name="clean" description="removes all generated collateral">
<delete dir="${classes.dir}" />
</target>
<target name="yank" description="fetch 3rdparty jars from maven central">
<mkdir dir="${lib.dir}" />
<yank:yank yankFile="${basedir}/yank.xls" destination="${lib.dir}" source="true" checkSHADigests="true">
<server url="https://repo1.maven.org/maven2"/>
<generatePath classpathName="ty.classpath" libraryDirName="$${lib.dir}" />
</yank:yank>
</target>
<target name="-init" depends="yank" description="prepares repository for a build">
<mkdir dir="${classes.dir}" />
</target>
<target name="compile" depends="-init" description="compiles java files">
<javac srcdir="${src.dir}" destdir="${classes.dir}">
<classpath refid="ty.classpath" />
</javac>
</target>
<target name="jar" depends="compile" description="produces the try jar file">
<jar destfile="${basedir}/try.jar">
<fileset dir="${classes.dir}">
<include name="**/*.class" />
</fileset>
</jar>
</target>
</project>