本文介绍了如何将Maven Web应用程序部署到本地安装的Glassfish?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用maven插件将maven Web应用程序部署到本地安装的glassfish服务器?

How one can deploy a maven web application to a locally instaled glassfish server using only maven plugins?

换句话说,如果我有一个包装=战争,可以使用诸如mvn clean package some-plugin:goal-deploy这样的命令部署到本地安装的glassfish?

In other words, if I have a maven project with packaging=war, it is possible to deploy to a locally installed glassfish using a command like "mvn clean package some-plugin:goal-deploy"?

推荐答案

是的,可以使用在以下示例中自我解释:

Yes, it is possible using the Cargo Maven Plugin, as it is self-explained in the following example:

<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <configuration>
                <container>
                    <containerId>glassfish4x</containerId>
                    <type>installed</type>
                    <!-- Path to directory where glassfish is installed -->
                    <home>C:/programs/glassfish4</home>
                </container>
                <configuration>
                    <type>existing</type>
                    <!-- Path to domains directory -->
                    <home>C:/programs/glassfish4/glassfish/domains</home>
                    <properties>
                        <!-- Domain name where application will be deployed. -->
                        <cargo.glassfish.domain.name>domain1</cargo.glassfish.domain.name>
                        <!-- Glassfish user to authenticate -->
                        <cargo.remote.username>admin</cargo.remote.username>
                        <!-- Glassfish password to authenticate -->
                        <cargo.remote.password></cargo.remote.password>
                    </properties>
                </configuration>
            </configuration>
        </plugin>
    </plugins>
</build>

使用上面引用的插件使用的maven命令是:

The maven commands to deploy using plugin cited above are:

mvn clean package cargo:deploy

clean package cargo:redeploy

这篇关于如何将Maven Web应用程序部署到本地安装的Glassfish?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 18:26