Giter VIP home page Giter VIP logo

ant-dep's Introduction

Ant Depends

This is a small task for Apache Ant to manage downloading of dependencies from various locations:

  • Maven central repository
  • Arbitrary URL
  • (More to come)

Usage

Add the task to your build.xml file thus:

<taskdef name="depends" classname="ant.dep.Depends" classpath="ant-dep/ant-dep.jar"/>

Obviously adjust the classpath to suit.

Create (within a target) a <depends dir="deps"> task specifying the directory to download denendencies to. Within that place a number of subtasks (detailed below) for the various dependencies.

Maven

Use the maven sub-task to download from the Maven Central Repository.

It not only handles getting the normal .jar files, but also JNA native jar files as well.

<depends dir="deps">
    <maven group="org.apache.commons" artifact="commons-compress" version="1.15" />
    <maven group="org.apache.commons" artifact="commons-io"       version="1.3.2" />
    <maven group="org.apache.commons" artifact="commons-lang3"    version="3.7" />
<maven>

If there are extra native jar files (which should be named according to the format {artifact}-{version}-{arch}.jar) you can add a collection of <native> tags within a dependency:

<depends dir="deps">
    <maven group="org.usb4java" artifact="libusb4java" version="1.2.0" >
        <native arch="linux-arm" />
        <native arch="linux-x86" />
        <native arch="linux-x86_64" />
        <native arch="osx-x86" />
        <native arch="osx-x86_64" />
        <native arch="windows-x86" />
        <native arch="windows-x86_64" />
    </maven>
</depends>

All the shown values are required, and there are no other values supported.

Files will be downloaded into the folder specified in the maven tag's dir value. They are named according to the format {artifact}.jar or, if a native jar file, {artifact}-{arch}.jar. If the file already exists it will be silently skipped.

Arbitrary URL

You can also download files from arbitrary URLs (much like the standard Apache Ant task get) - this just keeps it all integrated.

Use the download tag to download arbitrary files:

<depends dir="deps">
    <download url="http://example.com/file.zip" filename="file.zip"/>
</depends>

The file will be downloaded from the URL (following redirects across HTTP and HTTPS) and stored as the specified filename within the dependencies directory.

Again, if the file exists, it will be silently skipped.

Mixing

Different repository types can be mixed in one dependency set. For example, using all the above exaples:

<depends dir="deps">
    <maven group="org.apache.commons" artifact="commons-compress" version="1.15" />
    <maven group="org.apache.commons" artifact="commons-io"       version="1.3.2" />
    <maven group="org.apache.commons" artifact="commons-lang3"    version="3.7" />
    <maven group="org.usb4java" artifact="libusb4java"            version="1.2.0" >
        <native arch="linux-arm" />
        <native arch="linux-x86" />
        <native arch="linux-x86_64" />
        <native arch="osx-x86" />
        <native arch="osx-x86_64" />
        <native arch="windows-x86" />
        <native arch="windows-x86_64" />
    </maven>
    <download url="http://example.com/file.zip" filename="file.zip"/>
<maven>

ant-dep's People

Contributors

majenkotech 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.