maven 整合jboss可以采用两种方式,一种是使用cargo-maven2-plugin插件,一种可以是使用jboss-maven-plugin,本来采用的是jboss-maven-plugin插件来介绍maven与jboss插件整合
首先修改pom.xml文件,添加manven对应的jboss插件,其源码如下:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jboss-maven-plugin</artifactId>
<version>1.5.0</version>
<configuration>
<jbossHome>${env.JBOSS_HOME}</jbossHome>
<serverName>${jboss.serverName}</serverName>
<fileName>${project.build.directory}/${project.build.finalName}.${project.packaging}</fileName>
</configuration>
</plugin>
编写完成后我们执行
mvn clean install -Dmaven.test.skip=true
然后执行
mvn jboss:hard-deploy 即可
通过 http://localhost:8080 访问jboss主页即可验证jboss是否启动成功。
关于jboss-maven-plugin插件可以绑定的任务阶段
The following goals are available in this plugin.
- jboss:configure
Configure a JBoss Server. - jboss:start
Start a JBoss Server. - jboss:start-and-wait
Start a JBoss Server and wait for startup to complete. - jboss:stop
Shutdown a running JBoss Server. - jboss:deploy
Deploy a file or directory to JBoss using JMX. - jboss:undeploy
Undeploy a file or directory to JBoss using JMX. - jboss:redeploy
Redeploy a file or directory to JBoss using JMX. - jboss:hard-deploy
Deploy a file or directory to JBoss by copying files directly to the server deployment directory. - jboss:hard-undeploy
Undeploy a file or directory to JBoss by removing files from the server deployment directory
关于该插件的详细介绍可以查看