如何使用 Maven 将 .jar 文件部署到 JBoss EAP6 服务器?

How to deploy .jar file to JBoss EAP6 server using Maven?

我有一个 maven EJB projet,我想通过 maven 命令部署它。 我可以将该项目的 jar 放入我的 jboss 服务器的文件夹部署中,但我想通过 maven 来完成。 我进行了一些搜索,发现:

我可以实现的目标:jboss-as:deploy.

在pom.xml:

<plugin>
    <groupId>org.jboss.as.plugins</groupId>
    <artifactId>jboss-as-maven-plugin</artifactId>
    <configuration>
        <filename>${artifactId}-${project.version}.jar</filename>                      
    </configuration>                
</plugin>

给我的错误是:

[ERROR] Failed to execute goal org.jboss.as.plugins:jboss-as-maven-plugin:7.7.Final:deploy (default-cli) on project myapp: Could not execute goal deploy on D:\workspaces\myapp\target\myprojet-0.0.1.jar. Reason: I/O Error could not execute operation '{ [ERROR] "operation" => "read-attribute", [ERROR] "address" => [], [ERROR] "name" => "launch-type" [ERROR] }': java.net.ConnectException: JBAS012144: Could not connect to remote://localhost:9999. The connection timed out

这是standalone.xml的一部分:

enter  <interfaces>
    <interface name="management">
        <inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
    </interface>
    <interface name="public">
        <inet-address value="${jboss.bind.address:127.0.0.1}"/>
    </interface>
    <interface name="unsecure">
        <inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
    </interface>
</interfaces>

<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
    <socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9998}"/>
    <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9999}"/>
    <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9443}"/>
    <socket-binding name="ajp" port="8009"/>
    <socket-binding name="http" port="8080"/>
    <socket-binding name="https" port="8443"/>
    <socket-binding name="remoting" port="4447"/>
    <socket-binding name="txn-recovery-environment" port="4712"/>
    <socket-binding name="txn-status-manager" port="4713"/>
    <outbound-socket-binding name="mail-smtp">
        <remote-destination host="localhost" port="25"/>
    </outbound-socket-binding>
</socket-binding-group>

我有一个本地 Jboss 服务器。我试过这个(在 pom 中):

<plugin>
            <groupId>org.jboss.as.plugins</groupId>
            <artifactId>jboss-as-maven-plugin</artifactId>
            <version>7.5.Final</version>
            <configuration>
                <filename>${artifactId}-${project.version}.jar</filename>
                <username>test1</username>
                <password>Pass9584</password>
            </configuration>
</plugin>

您似乎已将本机管理端口更改为 9998。这就是插件用来连接服务器进行管理操作的。

 <socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9998}"/>

您需要将 <port>9998</port> 添加到您的插件配置中。

<plugin>
    <groupId>org.jboss.as.plugins</groupId>
    <artifactId>jboss-as-maven-plugin</artifactId>
    <version>7.5.Final</version>
    <configuration>
        <filename>${artifactId}-${project.version}.jar</filename>
        <port>9998</port>
    </configuration>
</plugin>