首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Dropwizard 0.8.0依赖关系问题

Dropwizard 0.8.0依赖关系问题
EN

Stack Overflow用户
提问于 2015-03-09 22:25:35
回答 1查看 515关注 0票数 0

如果我使用Dropwizard内核,一些项目不能通过ivy解决:

代码语言:javascript
复制
unresolved dependency: org.glassfish.hk2#hk2-utils;2.16: not found
unresolved dependency: org.glassfish.hk2#hk2-locator;2.16: not found

我的常春藤依赖关系是:

代码语言:javascript
复制
<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的bug吗?

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

编辑-正在尝试:

代码语言:javascript
复制
<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中已解决

EN

回答 1

Stack Overflow用户

发布于 2015-03-10 01:41:23

对我来说很有效...

也许您应该设置一个“默认”配置映射。

代码语言:javascript
复制
<dependency org="io.dropwizard" ....    conf="default"/>  

示例

以下示例为每个常春藤配置解析依赖项并创建报告。

代码语言:javascript
复制
├── 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

代码语言:javascript
复制
<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

代码语言:javascript
复制
<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>

备注:

  • 演示了如何生成常春藤报告和创建配置管理类路径
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28944402

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档