无法使用Ant通过Cargo自动启动jboss?

时间:2012-05-08 13:00:41

标签: xml ant build-automation cargo

在Cargo开源项目的帮助下,试图从Ant脚本自动启动JBoss。我在下方显示此错误。非常感谢!

的taskdef:

    <taskdef resource="cargo.tasks">
        <classpath>
            <pathelement location="${cargo.core.jar}"/>
            <pathelement location="${cargo.ant.jar}"/>
        </classpath>
    </taskdef>

Jar Used:

 cargo-core-uberjar-1.2.1.jar
 cargo-ant-1.2.1.jar

Ant目标:

<!-- Start JBoss -->
<target name="startJboss" depends="prepare">
    <cargo id="mycontainerid" containerId="jboss51x" home="C:/opt/jboss/jboss-4.0.5.GA/bin" action="start" wait="false" />
</target>

输出错误:

Buildfile: D:\opt\trunk\build.xml
startJboss:

BUILD FAILED
D:\opt\trunk\build.xml:51: Could not create type cargo due to java.lang.NoClassDefFoundError: org/apache/commons/discovery/resource/ClassLoaders

Total time: 2 seconds

1 个答案:

答案 0 :(得分:2)

如果您使用的是JBoss 4.0.5.GA,那么您是否应该使用containerId而不是jboss51x的匹配值? (我有一段时间没有使用过Cargo,所以我可能错了)

Cargo - Ant support page ANT任务可能还需要一些其他依赖项。有关详细信息,请参阅“安装”页面。;当我转到Installation时,它告诉我你需要满足Cargo的基本依赖关系,包括Commons Discovery(你的错误信息告诉我,缺少)和Commons Logging。将这些JAR添加到taskdef的类路径中,并再次拍摄。