简体   繁体   English

使用maven-wildfly插件部署webapp,在部署目录下部署war

[英]Deploying webapp with maven-wildfly plugin, deploy war under deployment directory

I am using wildfly-maven-plugin for deploying webapp to Wildfly 8.1 .我正在使用wildfly-maven-plugin将 webapp 部署到Wildfly 8.1 Using wildfly:deploy goal, and webapp get deployed somewhere in wildfly directory.使用wildfly:deploy目标,webapp 被部署在 wildfly 目录中的某个地方。 Following are my pom.xml and server.log.以下是我的 pom.xml 和 server.log。

<build>
        <plugins>             
            <plugin>
                <groupId>org.wildfly.plugins</groupId>
                <artifactId>wildfly-maven-plugin</artifactId>
                <version>1.0.2.Final</version> // Also tried latest one.
                <configuration>
                    <jbossHome>/home/me/jboss/</jbossHome>
                    <server-args>
                        <server-arg>-Djboss.server.base.dir=/home/me/jboss/standalone/</server-arg>
                        <server-arg>-b=0.0.0.0</server-arg>
                    </server-args>
                </configuration>
            </plugin>
        </plugins>
</build>

My small part of server.log我的server.log 的一小部分

13:55:22,418 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS018559: Deployed "MyApp-1.0-SNAPSHOT.war" (runtime-name : "MyApp-1.0-SNAPSHOT.war")
13:55:22,671 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
13:55:22,672 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
13:55:22,672 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.1.0.Final "Kenny" started in 60324ms - Started 668 of 722 services (93 services are lazy, passive or on-demand)

But my /standalone/deployment/ directory is blank, also no hidden files.但是我的/standalone/deployment/目录是空白的,也没有隐藏文件。 So where this thing get deployed !!那么这东西在哪里部署!! And also deleted all war files from target and .m2 directory.并且还删除了目标和 .m2 目录中的所有战争文件。

Webapp entry in standalone.xml Standalone.xml 中的Webapp 条目

<deployments>
    <deployment name="MyApp-1.0-SNAPSHOT.war" runtime-name="MyApp-1.0-SNAPSHOT.war">
            <content sha1="c9f1534c910dacdf6789ed585ae17cef73cfbe44"/>
    </deployment>
</deployments>

So I need to deploy war file under /standalone/deployments/ directory.所以我需要在/standalone/deployments/目录下部署war文件。

The Maven WildFly Plugin deploys the application through the administration interface (by default running on port 9990). Maven WildFly 插件通过管理界面(默认在端口 9990 上运行)部署应用程序。 The deployment always goes into the directory standalone/tmp.部署总是进入目录standalone/tmp。

The alternative for deployment to /standalone/deployments/ directory is copying the application war directly to it.部署到 /standalone/deployments/ 目录的替代方法是将应用程序战争直接复制到它。

To deploy your application under standalone directory, you need to copy it to that path.要将应用程序部署在独立目录下,您需要将其复制到该路径。 The configuration can be done from pom.xml as below:配置可以从 pom.xml 完成,如下所示:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <executions>
        <execution>
            <id>copy-war</id>
            <phase>install</phase>
            <goals>
                <goal>copy</goal>
            </goals>
            <configuration>
                <artifactItems>
                    <artifactItem>
                        <groupId>${project.groupId}</groupId>
                        <artifactId>${project.artifactId}</artifactId>
                        <version>${project.version}</version>
                        <type>${project.packaging}</type>
                        <overWrite>true</overWrite>
                        <outputDirectory>\home\me\jboss\standalone\deployments</outputDirectory>
                        <destFileName>${project.build.finalName}.${project.packaging}</destFileName>
                    </artifactItem>
                </artifactItems>
            </configuration>
        </execution>
    </executions>
</plugin>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM