Ivy Custom Resolvers for Git or TFS

I am new to Ivy, so maybe there is a direct way that I cannot find in the documentation or what I'm looking for is impossible, but here. I want to be able to specify dependencies where the source code is on local and / or remote servers that use different protocols.

In particular, I have some project dependencies that are stored on the TFS local network and additional project dependencies stored on the remote Git server (more precisely www.github.com). Is it possible that Ivy downloads the source code and creates a jar file that will then be used as a dependency? If so, how?

+5
source share
2 answers

, . Ivy , . (Maven, Ivy, Gradle ..) , . , .

? , , . , , VCS, - , .

+2

echo @dbyrne, . , Nexus .

....

, ivy , resolver. zip tar, ANT .

, "hello world" github leachim6 "-world.jar".

|-- build.xml
|-- ivysettings.xml
|-- ivy.xml
`-- repository
    `-- leachim6
        `-- hello-world
            `-- 1.0
                `-- packager.xml

ivy.xml

<ivy-module version="2.0">
    <info organisation="com.demo" module="packager_demo"/>
    <dependencies>
        <dependency org="leachim6" name="hello-world" rev="1.0"/>
    </dependencies>
</ivy-module>

1.0 "hello-world". , - .

ivysettings.xml

<ivysettings>
    <settings defaultResolver="central"/>
    <resolvers>
        <ibiblio name="central" m2compatible="true"/>
        <packager name="packager" buildRoot="${user.home}/.ivy2/packager/build" resourceCache="${user.home}/.ivy2/packager/cache" preserveBuildDirectories="false" restricted="false">
            <ivy pattern="file:///${ivy.settings.dir}/repository/[organisation]/[module]/[revision]/ivy.xml"/>
            <artifact pattern="file:///${ivy.settings.dir}/repository/[organisation]/[module]/[revision]/packager.xml"/>
        </packager>
    </resolvers>
    <modules>
        <module organisation="leachim6" name="hello-world" resolver="packager"/>
    </modules>
</ivysettings>

( ), . Maven Central, , "hello world" .

:

  • resourceCache. .
  • buildRoot. .
  • . ANT, javac delete. , .

packager.xml

<packager-module version="1.0">
    <property name="name" value="${ivy.packager.module}"/>
    <property name="version" value="${ivy.packager.revision}"/>

    <resource dest="archive" url="https://github.com/leachim6/hello-world/tarball/master" sha1="7f0e2836d1e8dc6130cca68d29b6f86027b22983" type="tar.gz"/>

    <build>
        <mkdir dir="classes"/>
        <javac srcdir="archive/leachim6-hello-world-38f6567/j" includes="*.java" destdir="classes"/>
        <jar destfile="artifacts/jars/${name}.jar" basedir="classes"/>
    </build>
</packager-module>

ANT script, "hello-world.jar".

ANT script, ( ) , .

:

  • . , javac.
  • , github . ( , )
+8

All Articles