为什么我的WAR文件没有使用jboss-maven-plugin出现在JBoss上?

时间:2012-08-24 20:28:31

标签: maven jboss maven-plugin

我正在运行JBoss 4.2.3.GA应用服务器(不能遗憾地改变它)并使用Maven 3.0.3构建WAR项目。我正在尝试使用jboss-maven-plugin将我的WAR文件部署到远程JBoss服务器。虽然Maven在执行构建时没有报告任何错误,但WAR文件永远不会出现在我的$ JBOSS_HOME / server / default / deploy目录中。这是我在pom.xml文件中使用的配置...

        <!-- 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-console定义的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] ------------------------------------------------------------------------

1 个答案:

答案 0 :(得分:1)

这是我的jboss-maven-plugin配置。通过这种配置,我可以毫无问题地部署我的war应用程序。看一下fileName路径。

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jboss-maven-plugin</artifactId>
    <version>1.5.0</version>
    <!-- JMX credentials defined in ~/.m2/settings.xml -->
    <configuration>
        <hostName>10.0.16.14</hostName> <!-- either an IP address or localhost -->
        <port>8280</port>
        <serverId>jboss-dev</serverId>
        <fileNames>
            <fileName>../server/default/deploy/myApp.war</fileName>
        </fileNames>
    </configuration>
</plugin>

我的〜/ .m2 / settings.xml服务器就像:

<servers>
    <server>
        <id>jboss-dev</id>
        <username>admin</username>
        <password>admin</password>
    </server>
</servers>