如何将 CARGO 指向 Jar 文件以部署在 JBoss 7.*?

How to point CARGO to Jar files to deploy on JBoss 7.*?

这是我尝试部署我的应用程序时 Jenkins 的控制台输出:

Caused by: org.codehaus.cargo.util.CargoException: Cannot locate the JBoss     connector classes! Make sure the required JBoss JARs (or Maven dependencies) are    in CARGO's classpath.
    More information on: http://cargo.codehaus.org/JBoss+Remote+Deployer
at org.codehaus.cargo.container.jboss.JBoss5xRemoteDeployer.<init>   (JBoss5xRemoteDeployer.java:161)
at org.codehaus.cargo.container.jboss.JBoss7xRemoteDeployer.<init>(JBoss7xRemoteDeployer.java:41)
... 26 more
Caused by: java.lang.ClassNotFoundException: org.jboss.as.controller.client.ModelControllerClient
at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1376)
at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1326)
at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1079)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.codehaus.cargo.container.jboss.JBoss5xRemoteDeployer.<init>(JBoss5xRemoteDeployer.java:156)
... 27 more
Build step 'Deploy war/ear to a container' marked build as failure
Finished: FAILURE

这是我的POM文件中关于CARGO的内容。

<plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <version>1.2.0</version>
            <configuration>
                <container>
                    <containerId>jboss7x</containerId>
                    <type>remote</type>
                </container>
            </configuration>
            <executions>
                <execution>
                    <id>deploy</id>
                    <phase>install</phase>
                    <goals>
                        <goal>redeploy</goal>
                    </goals>
                    <configuration>
                        <type>runtime</type>
                        <properties>
                            <cargo.hostname>localhost</cargo.hostname>
                            <cargo.jboss.management.port>19999</cargo.jboss.management.port>
                        </properties>
                    </configuration>
                </execution>
            </executions>
            <dependencies>
                <dependency>
                    <groupId>org.jboss.as</groupId>
                    <artifactId>jboss-as-controller-client</artifactId>
                    <version>7.1.1.Final</version>
                </dependency>
            </dependencies>
        </plugin>

我已经尝试了我在网上找到的所有其他解决方案,其中 none 可以解决问题。有什么想法吗?

看起来你的类加载器找不到jboss-as-controller-client,即使它被定义为插件依赖。

您可以尝试将 jboss-as-controller-client 定义为项目依赖项。如果问题仍然存在,则尝试将 jboss-as-controller-client jar 添加到使用的 java 的类路径中。

我通过将所有 jar 文件从 JBoss 模块文件夹复制到 jenkins/plugins/deploy/WEB-INF.

解决了这个问题