Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 944993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:41:00+00:00 2026-05-15T22:41:00+00:00

I’m trying to configure pom.xml so that it automatically deploys EAR archive to GlassFish

  • 0

I’m trying to configure pom.xml so that it automatically deploys EAR archive to GlassFish application server. I want to attach this operation to the proper maven execution phase. But can’t understand which one is dedicated just for this operation? Deploy? Install? Please, help. This is what I’m doing:

<plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
        <execution>
            <phase>deploy</phase>
            <configuration>
                <tasks>
                    <copy file="${project.build.directory}/${project.build.finalName}.ear" 
                        tofile="${glassfish.home}/domains/domain1/autodeploy"/>
                </tasks>
            </configuration>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
</plugin>

When I’m doing mvn deploy, maven is trying to deploy my artifacts to repository. This is not what I’m going to accomplish. I feel that the execution phase is wrong..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T22:41:00+00:00Added an answer on May 15, 2026 at 10:41 pm

    When I’m doing mvn deploy, maven is trying to deploy my artifacts to repository. This is not what I’m going to accomplish. I feel that the execution phase is wrong…

    In the Maven lingua, deploy has nothing to do with the deployment to an application server and is not an appropriate phase to bind a plugin doing this kind of work. Here is what we can read about the deploy phase in the Introduction to the Build Lifecycle:

    • deploy – done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.

    But, before I go further with phases, I need to mention that there are several plugins allowing to interact with GF (start/stop/deploy/undeploy/etc) that might do a better job than the AntRun plugin (AntRun might work for trivial use cases but, for example, you might want to wait for the deployment to be done and the application to be in a ready state during the build; for such use cases, you need more advanced control). These candidates are:

    • the Maven Glassfish Plugin: this is a GlassFish specific plugin that can be used with a local or remote GlassFish install.
    • the Maven Embedded GlassFish Plugin: this is a GlassFish specific plugin that runs an embedded GlassFish. Nice for portable builds.
    • the Maven Cargo Plugin: this a container agnostic plugin that now supports GlassFish 3.

    Using one or the other really depends on your use case. If you don’t plan to deploy on many containers, the GlassFish specific plugins are the most powerful. The beauty of Cargo is that it offers an unified API. But its configuration is less intuitive, especially if you’re not used to it.

    Now, if you just want to deploy an application during development and don’t want the build to interact in any way with the container, binding any of these plugins to a particular phase is not that useful, although some people do deploy their app during package.

    However, you might want to run integration/functional tests against a container as part of you build. This is actually a perfectly valid and very common use case and the relevant phases to implement this are:

    • pre-integration-test: perform actions required before integration
      tests are executed. This may involve
      things such as setting up the required
      environment.
    • integration-test: process and deploy the package if necessary into an
      environment where integration tests
      can be run.
    • post-integration-test: perform actions required after integration
      tests have been executed. This may
      including cleaning up the environment.

    The pre-integration-test phase is typically used to start a container and deploy an application on it. The post-integration-test phase is used to undeploy an application and stop the container.

    So I think that deploying to a server can be a typical build activity, there are very valid use cases, and this is well supported by Maven. I don’t deploy to my development server (nor to production server) as part of a build though.

    See also

    • Maven Embedded Glassfish Plugin
    • Which Maven Glassfish plugin to use?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.