我正在运行 JBoss 4.2.3.GA 应用服务器(可悲的是无法更改)并使用 Maven 3.0.3 构建 WAR 项目。我正在尝试使用 jboss-maven-plugin 将我的 WAR 文件部署到远程 JBoss 服务器。尽管 Maven 在我执行构建时没有报告任何错误,但 WAR 文件从未出现在我的 $JBOSS_HOME/server/default/deploy 目录中。这是我在 pom.xml 文件中使用的配置……</p>
<!-- Deploy app to remote JBoss instance -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jboss-maven-plugin</artifactId>
<version>1.5.0</version>
<configuration>
<serverId>default</serverId>
<hostName>localhost</hostName>
<port>8080</port>
<fileNames>
<fileName>${project.basedir}/target/${project.artifactId}-${project.version}.war</fileName>
</fileNames>
</configuration>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
在我的 ~/.m2/settings.xml 文件中,我有
<servers>
<server>
<id>default</id>
<username>admin</username>
<password>admin</password>
</server>
</servers>
其中用户名和密码是为访问我的 jmx 控制台而定义的 un/pw。下面是 Maven 的输出。注意没有错误报告。我还应该检查什么来弄清楚为什么我的 WAR 没有被部署?
[INFO] --- jboss-maven-plugin:1.5.0:deploy (default) @ myclient ---
[DEBUG] org.codehaus.mojo:jboss-maven-plugin:jar:1.5.0:
[DEBUG] org.apache.maven:maven-plugin-api:jar:2.0.11:compile
[DEBUG] org.apache.maven:maven-artifact-manager:jar:2.0.11:compile
[DEBUG] org.apache.maven:maven-repository-metadata:jar:2.0.11:compile
[DEBUG] org.apache.maven:maven-artifact:jar:2.0.11:compile
[DEBUG] org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
[DEBUG] junit:junit:jar:3.8.2:test (scope managed from compile) (version managed from 3.8.1)
[DEBUG] classworlds:classworlds:jar:1.1-alpha-2:compile
[DEBUG] org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-2:compile
[DEBUG] commons-codec:commons-codec:jar:1.3:compile
[DEBUG] jboss:jboss-jmx:jar:4.0.2:compile
[DEBUG] jboss:jnp-client:jar:4.0.2:compile
[DEBUG] jboss:jboss-common:jar:4.0.2:compile
[DEBUG] slide:webdavlib:jar:2.0:compile
[DEBUG] xerces:xercesImpl:jar:2.6.2:compile
[DEBUG] jboss:jbosssx-client:jar:3.2.3:compile
[DEBUG] velocity:velocity:jar:1.4:compile
[DEBUG] velocity:velocity-dep:jar:1.4:runtime
[DEBUG] org.codehaus.plexus:plexus-utils:jar:1.5.15:compile
[DEBUG] Created new class realm plugin>org.codehaus.mojo:jboss-maven-plugin:1.5.0
[DEBUG] Importing foreign packages into class realm plugin>org.codehaus.mojo:jboss-maven-plugin:1.5.0
[DEBUG] Imported: < maven.api
[DEBUG] Populating class realm plugin>org.codehaus.mojo:jboss-maven-plugin:1.5.0
[DEBUG] Included: org.codehaus.mojo:jboss-maven-plugin:jar:1.5.0
[DEBUG] Included: commons-codec:commons-codec:jar:1.3
[DEBUG] Included: jboss:jboss-jmx:jar:4.0.2
[DEBUG] Included: jboss:jnp-client:jar:4.0.2
[DEBUG] Included: jboss:jboss-common:jar:4.0.2
[DEBUG] Included: slide:webdavlib:jar:2.0
[DEBUG] Included: xerces:xercesImpl:jar:2.6.2
[DEBUG] Included: jboss:jbosssx-client:jar:3.2.3
[DEBUG] Included: velocity:velocity:jar:1.4
[DEBUG] Included: velocity:velocity-dep:jar:1.4
[DEBUG] Included: org.codehaus.plexus:plexus-utils:jar:1.5.15
[DEBUG] Excluded: org.apache.maven:maven-plugin-api:jar:2.0.11
[DEBUG] Excluded: org.apache.maven:maven-artifact-manager:jar:2.0.11
[DEBUG] Excluded: org.apache.maven:maven-repository-metadata:jar:2.0.11
[DEBUG] Excluded: org.apache.maven:maven-artifact:jar:2.0.11
[DEBUG] Excluded: org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1
[DEBUG] Excluded: junit:junit:jar:3.8.2
[DEBUG] Excluded: classworlds:classworlds:jar:1.1-alpha-2
[DEBUG] Excluded: org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-2
[DEBUG] Configuring mojo org.codehaus.mojo:jboss-maven-plugin:1.5.0:deploy from plugin realm ClassRealm[plugin>org.codehaus.mojo:jboss-maven-plugin:1.5.0, parent: sun.misc.Launcher$AppClassLoader@20cf2c80]
[DEBUG] Configuring mojo 'org.codehaus.mojo:jboss-maven-plugin:1.5.0:deploy' with basic configurator -->
[DEBUG] (f) fileNameEncoding = UTF-8
[DEBUG] (f) fileNames = [/Users/davea/Dropbox/workspace/myclient/target/myclient-1.0-SNAPSHOT.war]
[DEBUG] (f) hostName = localhost
[DEBUG] (f) port = 8080
[DEBUG] (f) serverId = default
[DEBUG] (f) skip = false
[DEBUG] -- end configuration --
[INFO] Deploying /Users/davea/Dropbox/workspace/myclient/target/myclient-1.0-SNAPSHOT.war to JBoss.
[DEBUG] url = http://localhost:8080/jmx-console/HtmlAdaptor?action=invokeOpByName&name=jboss.system:service %3DMainDeployer&methodName=deploy&argType=java.net.URL&arg0=%2FUsers%2Fdavea%2FDropbox%2Fworkspace%2Fmyclient%2Ftarget%2Fmyclient-1.0-SNAPSHOT.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------