开发者

Hot deployment to GlassFish using cargo-maven2-plugin, how to configure?

开发者 https://www.devze.com 2023-01-09 18:12 出处:网络
Did I understand right from this page that Cargo Maven plugin doesn\'t support hot remote deployment to GlassFish 3.x? If I\'m wrong, how can I configure it to support such type of operation?

Did I understand right from this page that Cargo Maven plugin doesn't support hot remote deployment to GlassFish 3.x? If I'm wrong, how can I configure it to support such type of operation?

Maybe I should use some other plugin? I'd like to deploy to GlassFish remote installation, through HTTP, in "h开发者_开发技巧ot" mode.


This is what I've done so far:

<plugin>
  <artifactId>maven-antrun-plugin</artifactId>
  <version>1.4</version>
  <executions>
    <execution>
      <phase>package</phase>
      <configuration>
        <tasks>
          <tempfile property="ant.temp-ear" deleteonexit="true" destdir="/tmp" />
          <copy
            file="${project.build.directory}/${project.build.finalName}.${project.packaging}" 
            tofile="${ant.temp-ear}" verbose="true" />
          <exec executable="${glassfish.home}/glassfish/bin/asadmin" 
            failonerror="true">
            <arg value="--user=${glassfish.username}"/>
            <arg value="--passwordfile=${glassfish.passwordfile}"/>
            <arg value="--interactive=false"/>
            <arg value="--host=${glassfish.host}"/>
            <arg value="--port=${glassfish.adminport}"/>
            <arg value="deploy"/>
            <arg value="--force"/>
            <arg value="--name=${project.artifactId}"/>
            <arg value="${ant.temp-ear}"/>
          </exec>
        </tasks>
      </configuration>
      <goals>
        <goal>run</goal>
      </goals>
    </execution>
  </executions>
</plugin>

Works perfectly, but asadmin (and the entire GlassFish, I assume) has to be installed on the same machine where mvn is executed.

Is it possible to perform the same task with Cargo plugin?


Does this answer your question?

<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <configuration>
                <container>
                    <containerId>glassfish3x</containerId>
                    <type>remote</type>
                </container>
                <configuration>
                    <type>runtime</type>
                    <properties>
                        <cargo.hostname>dev-server-01</cargo.hostname>
                        <cargo.servlet.port>8080</cargo.servlet.port>
                        <cargo.remote.username>user</cargo.remote.username>
                        <cargo.remote.password>pass</cargo.remote.password>
                        <cargo.glassfish.domain.name>domain-name</cargo.glassfish.domain.name>
                        <cargo.glassfish.adminPort>4848</cargo.glassfish.adminPort>
                    </properties>
                </configuration>
                <deployables>
                    <deployable>
                        <groupId>${project.groupId}</groupId>
                        <artifactId>${project.artifactId}</artifactId>
                        <type>war</type>
                    </deployable>
                </deployables>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.glassfish.main.deployment</groupId>
                    <artifactId>deployment-client</artifactId>
                    <version>3.1.2.2</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>
0

精彩评论

暂无评论...
验证码 换一张
取 消