heaphach
heaphach

Reputation: 1492

Dropwizard 0.8.0 Dependency Problems

If I use Dropwizard core, some projects can not be resolved via ivy:

unresolved dependency: org.glassfish.hk2#hk2-utils;2.16: not found
unresolved dependency: org.glassfish.hk2#hk2-locator;2.16: not found

My ivy dependencies are:

<dependency org="io.dropwizard" name="dropwizard-core" rev="0.8.0" />  
<dependency org="io.dropwizard" name="dropwizard-jersey" rev="0.8.0"   />
<dependency org="org.apache.commons" name="commons-lang3" rev="3.3.2"/>

If I search for hk-utils or hk2-locator, then I can not find the wanted version 2.16 ... Is this a Drowpizard 0.8.0 bug?

Does someone knows how to resolve this? Thank you.

EDIT - Trying this:

<dependency org="io.dropwizard" name="dropwizard-core" rev="0.8.0">
    <exclude org="org.glassfish.hk2" module="hk2-utils" />
    <exclude org="org.glassfish.hk2" module="hk2-locator" />
</dependency>  
<dependency org="org.glassfish.hk2" name="hk2-utils" rev="2.4.0-b09" />
<dependency org="org.glassfish.hk2" name="hk2-locator" rev="2.4.0-b09" />

Update: Same in Dropwizard 0.8.1 Update: Seems to be solved in Dropwizard 0.8.4

Upvotes: 0

Views: 540

Answers (1)

Mark O&#39;Connor
Mark O&#39;Connor

Reputation: 77991

Works for me....

Perhaps you should setup a "default" configuration mapping.

<dependency org="io.dropwizard" ....    conf="default"/>  

Example

The following example resolves dependencies and creates a report for each ivy configuration.

├── build
│   └── ivy-reports
│       ├── com.myspotontheweb-demo-compile.html
│       ├── com.myspotontheweb-demo-runtime.html
│       ├── com.myspotontheweb-demo-test.html
│       └── ivy-report.css
├── build.xml
└── ivy.xml

ivy.xml

<ivy-module version="2.0">
    <info organisation="com.myspotontheweb" module="demo"/>

    <configurations>
        <conf name="compile" description="Required to compile application"/>
        <conf name="runtime" description="Additional run-time dependencies" extends="compile"/>
        <conf name="test"    description="Required for test only" extends="runtime"/>
    </configurations>

    <dependencies>
        <!-- compile dependencies -->
        <dependency org="io.dropwizard" name="dropwizard-core" rev="0.8.0"    conf="compile->default"/>  
        <dependency org="io.dropwizard" name="dropwizard-jersey" rev="0.8.0"  conf="compile->default"/>
        <dependency org="org.apache.commons" name="commons-lang3" rev="3.3.2" conf="compile->default"/>

        <!-- runtime dependencies -->

        <!-- test dependencies -->
    </dependencies>

</ivy-module>

build.xml

<project name="demo" default="resolve" xmlns:ivy="antlib:org.apache.ivy.ant">

    <available classname="org.apache.ivy.Main" property="ivy.installed"/> 

    <target name="install-ivy" description="Install ivy" unless="ivy.installed">
        <mkdir dir="${user.home}/.ant/lib"/>
        <get dest="${user.home}/.ant/lib/ivy.jar" src="http://search.maven.org/remotecontent?filepath=org/apache/ivy/ivy/2.4.0/ivy-2.4.0.jar"/>
        <fail message="Ivy has been installed. Run the build again"/>
    </target>

    <target name="resolve" depends="install-ivy" description="Use ivy to resolve classpaths">
        <ivy:resolve/>

        <ivy:report todir='build/ivy-reports' graph='false' xml='false'/>

        <ivy:cachepath pathid="compile.path" conf="compile"/>
        <ivy:cachepath pathid="test.path"    conf="test"/>
    </target>

    <target name="clean" description="Cleanup build files">
        <delete dir="build"/>
    </target>

    <target name="clean-all" depends="clean" description="Additionally purge ivy cache">
        <ivy:cleancache/>
    </target>

</project>

Notes:

  • Demonstrates how to generate an ivy report and create configuration manage classpaths

Upvotes: 1

Related Questions