如何在 SBT 中声明对 jboss 的依赖?

发布于 2024-11-26 18:03:46 字数 228 浏览 1 评论 0原文

我有一个依赖于 JBoss(特别是 5.1.0.GA)的项目,我正在尝试使用 SBT 设置该项目。我想知道是否有一种方法可以说“这个项目依赖于 JBoss 版本 X 以及与之相关的所有内容”,或者我是否必须单独声明每个依赖项?我希望 SBT 随后能够下载编译该项目所需的所有适当的依赖项。

我对依赖管理还很陌生,所以任何方向都会受到赞赏。我正在尝试使用 SBT(使用 Ivy)来做到这一点,但也欢迎使用 Maven 中的示例。

I have a project that depends on JBoss(specifically 5.1.0.GA) and I was playing around with trying to set this project up using SBT. What I was wondering is if there is a way to say "this project depends on JBoss version X and everything that goes with it" or do I have do declare every single dependency individually? My hope is that SBT will then download all the appropriate dependencies needed to compile the project.

I am pretty new to dependency management so any direction is appreciated. I am trying to do this using SBT (which uses Ivy) but an example in maven is also welcome.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时光倒影 2024-12-03 18:03:46

您必须手动声明每个依赖项,没有包含所有依赖项的超级 pom。

这通常非常棘手,因为在某些情况下很难找出您到底需要什么。

一个好的开始是获取 jboss_home/lib 下的每个库,并从那里开始减少。

如果您有自己的存储库代理(例如artifactory或archiva),您可以创建这样的超级pom。

这是来自我自己的存储库,可能会帮助您入门。但这绝不是官方的,也不符合我的需要。

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="http://www.jayasoft.fr/org/ivyrep/ivy-doc.xsl"?>
<ivy-module version="1.0">
    <info 
        organisation="jboss"
        module="jboss"
        revision="5.1.0"
        status="release"
        publication="20110801120000"/>
    <configurations>
            <conf name="compile" visibility="public" />
            <conf name="client" visibility="public" extends="compile,mail,activation, aop"/>
            <conf name="server" visibility="public" extends="compile,servlet,jmx"/>
            <conf name="hibernate" visibility="public" />
            <conf name="activation" visibility="public" />
            <conf name="mail" visibility="public" />
            <conf name="servlet" visibility="public" />
            <conf name="jmx" visibility="public" />
                    <conf name="jmx-client" visibility="public" extends="client,jmx"/>
            <conf name="aop" visibility="public" />
            <conf name="javaee" visibility="public" />
            <conf name="ant" visibility="public" />
      <conf name="logging" visibility="public" />
    </configurations>
    <publications>
    <!-- from jbossall-client readme.txt -->
            <artifact name="commons-logging"      type="jar" conf="client"/>
        <artifact name="concurrent"      type="jar" conf="client"/>
        <artifact name="ejb3-persistence"      type="jar" conf="client"/>
        <artifact name="jboss-aop-client"      type="jar" conf="client"/>
        <artifact name="jboss-appclient"      type="jar" conf="client"/>
        <artifact name="jboss-aspect-jdk50-client"      type="jar" conf="client"/>
        <artifact name="jboss-client"      type="jar" conf="client,ant"/>
        <artifact name="jboss-common-core"      type="jar" conf="client,ant"/>
        <artifact name="jboss-ejb3-common-client"      type="jar" conf="client"/>
        <artifact name="jboss-ejb3-core-client"      type="jar" conf="client"/>
        <artifact name="jboss-ejb3-proxy-impl-client"      type="jar" conf="client"/>
        <artifact name="jboss-ejb3-proxy-spi-client"      type="jar" conf="client"/>
        <artifact name="jboss-ejb3-security-client"      type="jar" conf="client"/>
        <artifact name="jboss-j2se"      type="jar" conf="client"/>
        <artifact name="jboss-javaee"      type="jar" conf="client,javaee,ant"/>
        <artifact name="jboss-logging-log4j"      type="jar" conf="client"/>
        <artifact name="jboss-logging-spi"      type="jar" conf="client,ant"/>
        <artifact name="jboss-messaging-client"      type="jar" conf="client"/>
        <artifact name="jboss-remoting"      type="jar" conf="client"/>
        <artifact name="jboss-security-spi"      type="jar" conf="client,ant"/>
        <artifact name="jboss-serialization"      type="jar" conf="client,ant"/>
        <artifact name="jboss-system-client"      type="jar" conf="client"/>
        <artifact name="jboss-system-jmx-client"      type="jar" conf="client"/>
        <artifact name="jbosssx-as-client"      type="jar" conf="client,ant"/>
        <artifact name="jbosssx-client"      type="jar" conf="client,ant"/>
        <artifact name="jmx-client"      type="jar" conf="client,ant"/>
        <artifact name="jnp-client"      type="jar" conf="client"/>
        <artifact name="jboss-mdr"      type="jar" conf="client"/>
        <!--END from  jbossall-client readme.txt -->
        <!-- additional client-libs -->
        <artifact name="jbosscache-core"        type="jar" conf="client"/>
        <artifact name="trove"      type="jar" conf="client"/>
        <artifact name="javassist"      type="jar" conf="client,hibernate"/>
        <!-- END additional client-libs -->
        <artifact name="activation"         type="jar" conf="activation"/>
        <artifact name="mail"               type="jar" conf="mail"/>
        <artifact name="jboss-javaee"       type="jar" conf="compile"/>
        <artifact name="jboss-j2se"         type="jar" conf="compile"/>
        <artifact name="jboss-system-jmx"       type="jar" conf="compile,jmx"/>
        <artifact name="jbosscache-core"        type="jar" conf="compile"/>
        <artifact name="jboss-remoting"         type="jar" conf="compile,ant"/>
        <artifact name="jboss-kernel"       type="jar" conf="compile"/>
        <artifact name="jboss-logging-spi"      type="jar" conf="compile, logging"/>
        <artifact name="jboss-security-spi"         type="jar" conf="compile"/>
        <artifact name="jboss-ejb3-ext-api"         type="jar" conf="server"/>
        <artifact name="jboss-ejb3-core"      type="jar" conf="server"/>
        <artifact name="jboss-integration"      type="jar" conf="compile,ant"/>
        <artifact name="ejb3-persistence"   type="jar" conf="hibernate"/>
        <artifact name="hibernate-core"         type="jar" conf="hibernate"/>
        <artifact name="hibernate-entitymanager" type="jar" conf="hibernate"/>
        <artifact name="hibernate-annotations"  type="jar" conf="hibernate"/>
        <artifact name="hibernate-commons-annotations"  type="jar" conf="hibernate"/>
        <artifact name="jboss-system-client"    type="jar" conf="server"/>
        <artifact name="servlet-api"        type="jar" conf="servlet"/>
        <artifact name="jbosssx"            type="jar" conf="server"/>
        <artifact name="jmx-invoker-adaptor-client"     type="jar" conf="server,jmx,ant"/>
        <artifact name="antlr"  type="jar" conf="hibernate"/>       
        <artifact name="slf4j-api"  type="jar" conf="server, logging"/>
        <artifact name="slf4j-jboss-logging"    type="jar" conf="server, logging"/>
        <artifact name="jboss-aop-client"  type="jar" conf="aop"/>
        <artifact name="jbossjmx-ant"  type="jar" conf="ant"/>
    </publications>
</ivy-module>

You have to declare every dependency manually, there is no super-pom, that includes all dependencies.

This is mostly very tricky, because it is hard to find out, what you need exactly in some cases.

A good start is to take every lib, that is also under jboss_home/lib and start reducing from there.

If you have your own repository proxy (like artifactory or archiva), you could create such a super pom.

This is from my own repository and might help getting you started. But this is in no way official and fitted to my needs.

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="http://www.jayasoft.fr/org/ivyrep/ivy-doc.xsl"?>
<ivy-module version="1.0">
    <info 
        organisation="jboss"
        module="jboss"
        revision="5.1.0"
        status="release"
        publication="20110801120000"/>
    <configurations>
            <conf name="compile" visibility="public" />
            <conf name="client" visibility="public" extends="compile,mail,activation, aop"/>
            <conf name="server" visibility="public" extends="compile,servlet,jmx"/>
            <conf name="hibernate" visibility="public" />
            <conf name="activation" visibility="public" />
            <conf name="mail" visibility="public" />
            <conf name="servlet" visibility="public" />
            <conf name="jmx" visibility="public" />
                    <conf name="jmx-client" visibility="public" extends="client,jmx"/>
            <conf name="aop" visibility="public" />
            <conf name="javaee" visibility="public" />
            <conf name="ant" visibility="public" />
      <conf name="logging" visibility="public" />
    </configurations>
    <publications>
    <!-- from jbossall-client readme.txt -->
            <artifact name="commons-logging"      type="jar" conf="client"/>
        <artifact name="concurrent"      type="jar" conf="client"/>
        <artifact name="ejb3-persistence"      type="jar" conf="client"/>
        <artifact name="jboss-aop-client"      type="jar" conf="client"/>
        <artifact name="jboss-appclient"      type="jar" conf="client"/>
        <artifact name="jboss-aspect-jdk50-client"      type="jar" conf="client"/>
        <artifact name="jboss-client"      type="jar" conf="client,ant"/>
        <artifact name="jboss-common-core"      type="jar" conf="client,ant"/>
        <artifact name="jboss-ejb3-common-client"      type="jar" conf="client"/>
        <artifact name="jboss-ejb3-core-client"      type="jar" conf="client"/>
        <artifact name="jboss-ejb3-proxy-impl-client"      type="jar" conf="client"/>
        <artifact name="jboss-ejb3-proxy-spi-client"      type="jar" conf="client"/>
        <artifact name="jboss-ejb3-security-client"      type="jar" conf="client"/>
        <artifact name="jboss-j2se"      type="jar" conf="client"/>
        <artifact name="jboss-javaee"      type="jar" conf="client,javaee,ant"/>
        <artifact name="jboss-logging-log4j"      type="jar" conf="client"/>
        <artifact name="jboss-logging-spi"      type="jar" conf="client,ant"/>
        <artifact name="jboss-messaging-client"      type="jar" conf="client"/>
        <artifact name="jboss-remoting"      type="jar" conf="client"/>
        <artifact name="jboss-security-spi"      type="jar" conf="client,ant"/>
        <artifact name="jboss-serialization"      type="jar" conf="client,ant"/>
        <artifact name="jboss-system-client"      type="jar" conf="client"/>
        <artifact name="jboss-system-jmx-client"      type="jar" conf="client"/>
        <artifact name="jbosssx-as-client"      type="jar" conf="client,ant"/>
        <artifact name="jbosssx-client"      type="jar" conf="client,ant"/>
        <artifact name="jmx-client"      type="jar" conf="client,ant"/>
        <artifact name="jnp-client"      type="jar" conf="client"/>
        <artifact name="jboss-mdr"      type="jar" conf="client"/>
        <!--END from  jbossall-client readme.txt -->
        <!-- additional client-libs -->
        <artifact name="jbosscache-core"        type="jar" conf="client"/>
        <artifact name="trove"      type="jar" conf="client"/>
        <artifact name="javassist"      type="jar" conf="client,hibernate"/>
        <!-- END additional client-libs -->
        <artifact name="activation"         type="jar" conf="activation"/>
        <artifact name="mail"               type="jar" conf="mail"/>
        <artifact name="jboss-javaee"       type="jar" conf="compile"/>
        <artifact name="jboss-j2se"         type="jar" conf="compile"/>
        <artifact name="jboss-system-jmx"       type="jar" conf="compile,jmx"/>
        <artifact name="jbosscache-core"        type="jar" conf="compile"/>
        <artifact name="jboss-remoting"         type="jar" conf="compile,ant"/>
        <artifact name="jboss-kernel"       type="jar" conf="compile"/>
        <artifact name="jboss-logging-spi"      type="jar" conf="compile, logging"/>
        <artifact name="jboss-security-spi"         type="jar" conf="compile"/>
        <artifact name="jboss-ejb3-ext-api"         type="jar" conf="server"/>
        <artifact name="jboss-ejb3-core"      type="jar" conf="server"/>
        <artifact name="jboss-integration"      type="jar" conf="compile,ant"/>
        <artifact name="ejb3-persistence"   type="jar" conf="hibernate"/>
        <artifact name="hibernate-core"         type="jar" conf="hibernate"/>
        <artifact name="hibernate-entitymanager" type="jar" conf="hibernate"/>
        <artifact name="hibernate-annotations"  type="jar" conf="hibernate"/>
        <artifact name="hibernate-commons-annotations"  type="jar" conf="hibernate"/>
        <artifact name="jboss-system-client"    type="jar" conf="server"/>
        <artifact name="servlet-api"        type="jar" conf="servlet"/>
        <artifact name="jbosssx"            type="jar" conf="server"/>
        <artifact name="jmx-invoker-adaptor-client"     type="jar" conf="server,jmx,ant"/>
        <artifact name="antlr"  type="jar" conf="hibernate"/>       
        <artifact name="slf4j-api"  type="jar" conf="server, logging"/>
        <artifact name="slf4j-jboss-logging"    type="jar" conf="server, logging"/>
        <artifact name="jboss-aop-client"  type="jar" conf="aop"/>
        <artifact name="jbossjmx-ant"  type="jar" conf="ant"/>
    </publications>
</ivy-module>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文