我使用1.4版本的Jboss-Maven-Plugin.我看JBoss Maven Plugin Usage Example,而我是pom.xml
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jboss-maven-plugin</artifactId>
<version>1.4</version>
<configuration>
<jbossHome>E:\JavaWorkingTools\JBoss\jboss-5.1.0.GA</jbossHome>
<serverName>default</serverName>
<hostName>localhost</hostName>
<port>8080</port>
<fileName>${project.build.directory}/${{project.build.finalName}.war</fileName>
</configuration>
</plugin>
我输入jboss:启动控制台消息是INFO!但是Terminate没有运行?
信息消息是:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SSH2Maven JEE5 Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- jboss-maven-plugin:1.4:start (default-cli) @ SSH2Maven ---
[INFO] Starting JBoss...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.328s
[INFO] Finished at: Sun Jul 11 19:10:15 CST 2010
[INFO] Final Memory: 2M/15M
[INFO] ------------------------------------------------------------------------
为什么?这个版本只能用于4.x以下?
解决方法:
好的,首先,该插件并非真正为JBoss AS 5设计,虽然某些功能可用(启动,停止,硬部署),但某些部署功能可能无法正常工作.
其次,jboss:start
的目标不是“阻塞”,它将在后台启动JBoss作为一个独立的进程.
这是我在运行jboss一段时间后得到的:从JBoss 5开始(以及类似于你的插件配置):
$mvn jboss:start [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building my-webapp Maven Webapp [INFO] task-segment: [jboss:start] (aggregator-style) [INFO] ------------------------------------------------------------------------ [INFO] [jboss:start {execution: default-cli}] [INFO] Starting JBoss... [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ ... $ps aux | grep -i jboss pascal 23080 0.0 0.0 1828 292 pts/3 S 23:02 0:00 sh -c cd /home/pascal/opt/jboss-5.1.0.GA/bin; export JBOSS_HOME="/home/pascal/opt/jboss-5.1.0.GA"; ./run.sh null pascal 23107 91.4 30.3 1116240 624824 pts/3 Sl 23:02 3:19 /usr/lib/jvm/java-6-sun/bin/java -Dprogram.name=run.sh -server -Xms128m -Xmx512m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.net.preferIPv4Stack=true -Djava.endorsed.dirs=/home/pascal/opt/jboss-5.1.0.GA/lib/endorsed -classpath /home/pascal/opt/jboss-5.1.0.GA/bin/run.jar:/usr/lib/jvm/java-6-sun/lib/tools.jar org.jboss.Main null pascal 23298 0.0 0.0 3324 916 pts/3 S+ 23:06 0:00 grep -i jboss
正如预期的那样,JBoss已经启动.
更新:这是我使用的配置(快速和脏,用于测试目的):
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jboss-maven-plugin</artifactId>
<version>1.4.1</version>
<configuration>
<jbossHome>/home/pascal/opt/jboss-5.1.0.GA</jbossHome>
<serverName>default</serverName>
<fileName>target/my-project.war</fileName>
</configuration>
</plugin>