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

时间:2011-07-28 19:19:46

标签: maven-2 sbt jboss5.x ivy dependency-management

我有一个依赖于JBoss(特别是5.1.0.GA)的项目,我正在尝试使用SBT设置此项目。我想知道的是,是否有办法说“这个项目依赖于JBoss版本X以及随之而来的一切”或者我是否已经单独声明了每一个依赖项?我希望SBT将下载编译项目所需的所有适当的依赖项。

我对依赖管理很新,所以任何方向都值得赞赏。我试图使用SBT(使用常春藤)来做到这一点,但也欢迎maven中的一个例子。

1 个答案:

答案 0 :(得分:2)

你必须手动声明每个依赖项,没有super-pom,包括所有依赖项。

这主要是非常棘手的,因为在某些情况下很难找到你需要的东西。

一个好的开始就是把每一个lib都放在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>