Deployment Maven glassfish插件:如何指定部署目标?

Deployment Maven glassfish插件:如何指定部署目标?,deployment,maven-3,glassfish-2.x,maven-glassfish-plugin,Deployment,Maven 3,Glassfish 2.x,Maven Glassfish Plugin,我将Maven 3.0.4与Maven glassfish插件2.1()和glassfish 2.1.1一起使用 相关POM.XML片段: <profile> <id>deploy</id> <build> <plugins> <plugin> <groupId>org.glassfis

我将Maven 3.0.4与Maven glassfish插件2.1()和glassfish 2.1.1一起使用

相关POM.XML片段:

<profile>
        <id>deploy</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.glassfish.maven.plugin</groupId>
                    <artifactId>maven-glassfish-plugin</artifactId>
                    <version>2.1</version>
                    <configuration>
                        <glassfishDirectory>/home/user/glassfish</glassfishDirectory>
                        <domain>
                            <name>domain1</name>
                            <host>hostname</host>
                            <adminPort>4848</adminPort>
                        </domain>
                        <autoCreate>false</autoCreate>
                        <terse>true</terse>
                        <debug>false</debug>
                        <echo>true</echo>
                        <user>admin</user>
                        <passwordFile>/home/user/user.gfpass</passwordFile>
                        <components>
                            <component>
                                <name>${project.artifactId}</name>
                                <artifact>${project.build.directory}/${project.build.finalName}.war</artifact>
                            </component>
                        </components>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
注意执行的命令中的目标服务器


如何在POM中指定要部署到哪个实例(即
目标
)?

经过进一步研究,答案是不,我不能

我知道有两种选择:

  • 使用
    exec maven plugin
    调用带有所需参数的
    asadmin
    ,或
  • 对自己版本的
    maven glassfish插件进行更改
    必需的(这是我目前所做的)

  • 事实证明,这个插件非常简单,我可以根据自己的需要修改它。更麻烦的是构建它,但那是另一回事。

    您好,我的解决方案是:

    我离开pom作为重新部署执行

            <execution>
                    <id>gf-deploy</id>
                    <phase>package</phase>
                    <goals>
                        <goal>redeploy</goal>
                    </goals>
                </execution>
    
    在做了这个修改后,reploy总是工作得很好

            <execution>
                    <id>gf-deploy</id>
                    <phase>package</phase>
                    <goals>
                        <goal>redeploy</goal>
                    </goals>
                </execution>
    
    :run
    if NOT %1 == undeploy goto :end
    %JAVA% -jar "%~dp0..\lib\client\appserver-cli.jar" %*
    ECHO "TEST"
    :end
    
    if %1 == undeploy goto :end1
    %JAVA% -jar "%~dp0..\lib\client\appserver-cli.jar" %*
    :end1