Jboss-Maven-Plugin无法启动?

时间:2010-07-11 11:20:35

标签: java maven-2 jboss java-ee

我使用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中使用?

1 个答案:

答案 0 :(得分:3)

好的,首先,该插件并不是专为JBoss AS 5设计的,虽然某些功能可以使用(启动,停止,硬部署),但某些部署功能可能无效。

其次,jboss:start目标不是“阻塞”,它将在后台启动JBoss作为一个独立的进程。

以下是我在使用JBoss 5运行jboss:start(以及类似于你的插件配置)后得到的结果:

$ 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>