Dropwizard 0.8.0依赖问题

时间:2015-03-09 14:25:35

标签: jersey ivy dropwizard

如果我使用Dropwizard核心,有些项目无法通过常春藤来解决:

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

我的常春藤依赖项是:

<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"/>

如果我搜索hk-utils或hk2-locator,那么我找不到想要的版本2.16 ...这是一个Drowpizard 0.8.0错误吗?

有人知道如何解决这个问题吗?谢谢。

编辑 - 试试这个:

<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" />

更新:在Dropwizard 0.8.1中相同 更新:似乎在Dropwizard 0.8.4中解决了

1 个答案:

答案 0 :(得分:1)

为我工作....

也许你应该设置一个&#34;默认&#34;配置映射。

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

实施例

以下示例解决了依赖关系并为每个常春藤配置创建了一个报告。

├── 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>

注意:

  • 演示如何生成常春藤报告并创建配置管理类路径