使用jboss-as-maven-plugin在Wildfly上部署

时间:2015-03-22 18:11:29

标签: java maven jboss

我其实真的很新...... 每当我尝试在Wildfly中部署war文件时,它都会给我这个错误:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.774 s
[INFO] Finished at: 2015-03-23T01:56:20+08:00
[INFO] Final Memory: 24M/283M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jboss.as.plugins:jboss-as-maven-plugin:7.3.Fi
nal:deploy (default-cli) on project jbpm6-example: Could not execute goal deploy
 on E:\Apps\jbpm6-example\target\jbpm6-example-1.0.war. Reason: Error could not
execute operation '{
[ERROR] "address" => [],
[ERROR] "operation" => "read-attribute",
[ERROR] "name" => "launch-type"
[ERROR] }'. java.net.ConnectException: JBAS012144: Could not connect to remote:/
/localhost:9999. The connection timed out
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception

我已尝试在pom.xml中配置插件,以便连接到端口9999,因为我搜索过的wildfly正在使用端口9990 ..

 <plugin>
    <groupId>org.jboss.as.plugins</groupId>
    <artifactId>jboss-as-maven-plugin</artifactId>
    <version>7.3.Final</version>

    <configuration>  
     <hostname>localhost</hostname>  
     <port>9999</port>
    </configuration>  

  </plugin>

但仍然无法部署它......

我也尝试过使用wildfly-maven-plugin,但它也给我一个错误:部署失败并被回滚

1 个答案:

答案 0 :(得分:0)

较旧的jboss-as-maven-plugin无法使用WildFly。您只需要使用较新的wildfly-maven-plugin。它可以定义为:

<project> ... <build> ... <plugins> ... <plugin> <groupId>org.wildfly.plugins</groupId> <artifactId>wildfly-maven-plugin</artifactId> <version>1.1.0.Alpha1</version> </plugin> ... </plugins> ... </build> ... </project>

然后mvn wildfly:deploy将起作用。

这是一个提供更多详细信息的博客:

http://blog.arungupta.me/wildfly-maven-plugin-tech-tip-9/

https://github.com/javaee-samples/javaee7-samples处的所有Java EE 7样本也使用此插件。

或者,您可以在以下位置使用此插件找到更简单的Java EE 7示例:

https://github.com/javaee-samples/javaee7-simple-sample/blob/master/pom.xml