GithubHelp home page GithubHelp logo

yank's Introduction

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>

yank's People

Contributors

mebigfatguy avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.