Answers: <p>If you want just to deploy faster to server(propably not only Glassfish) you can just write code in gradle to do that. 
  Example taken from <a href="https://www.schuermann.eu/2013/08/03/gradle-glassfish.html" rel="nofollow noreferrer">here</a></p>
  
  <pre><code>/**
   *  ~/.gradle/gradle.properties:
   *  glassfishHome=/path/to/glassfish_home
   *
   *  or in Netbeans, right click project, Properties, Manage Build in Tasks, Run
   *  Add line to Arguments: -Dorg.gradle.project.glassfishHome=/path/to/glassfish_home
   *
   *  For more information about Exec tasks see
   *  http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.Exec.html
   */
  task run(dependsOn: 'war', type:Exec) {
      workingDir "${glassfishHome}${File.separator}bin"
  
      if (System.properties['os.name'].toLowerCase().contains('windows')) {
          commandLine 'cmd', '/c', 'asadmin.bat'
      } else {
          commandLine "./asadmin"
      }
  
      args "deploy", "--force=true", "${war.archivePath}"
  //from: https://www.schuermann.eu/2013/08/03/gradle-glassfish.html
  }
  </code></pre>
  
  <p>In other words just use your asadmin</p>
  
Answers: CC BY-SA 3.0
Answers: 2017-08-24T01:53:31.580Z
Answers: I was thinking there might be a plug-in or API to interface with asadmin.  this is not such a typical task?  most use some other approach?
Answers: Thufir
Answers: CC BY-SA 3.0
Answers: 2017-08-24T12:15:39.667Z
Answers: Usually you will have some kind of CI(like jenkins) which will compile/deploy your code from repository. There are some plugins in gradle, but usually they just deploy to local/integrated glassfish instance. In Maven it is made by normal asadmin too.
Answers: Michał Piątkowski
Answers: CC BY-SA 3.0
Answers: 2017-08-23T15:47:05.487Z
Answers: 2017-08-23T15:47:05.487Z
Answers: Michał Piątkowski
Body: <p>I'm getting a <a href="https://stackoverflow.com/q/45829987/262852">bit</a> deeper into Gradle and want to further automate the process.  Generally speaking what are the approaches towards interacting with application servers?</p>
  
  <p>I'd want to automate deploying an <code>EAR</code>.  Is there even a need, or case to be made, to step out of Gradle for that purpose?</p>
  
  <p>I imagine it's much the same regardless whether it's <code>EAR</code> or <code>WAR</code> files and regardless of the specific application server -- but I'm using Glassfish.</p>
  
Tags: <terminology><deployment><automation><toolchain><gradle>
Title: Is Gradle used to automate deployment of EAR and WAR files to application servers?
UserDisplayName: Thufir
ThreadText: # Is Gradle used to automate deployment of EAR and WAR files to application servers?
  
  (Asked by: username_0 on 2017-08-23)
  
  I'm getting a [bit](https://stackoverflow.com/q/45829987/262852) deeper into Gradle and want to further automate the process. Generally speaking what are the approaches towards interacting with application servers?
  
  I'd want to automate deploying an `EAR`. Is there even a need, or case to be made, to step out of Gradle for that purpose?
  
  I imagine it's much the same regardless whether it's `EAR` or `WAR` files and regardless of the specific application server -- but I'm using Glassfish.
  
  **Tags:** terminology, deployment, automation, toolchain, gradle
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-08-23. Score: 2
  
  If you want just to deploy faster to server(propably not only Glassfish) you can just write code in gradle to do that.
  Example taken from [here](https://www.schuermann.eu/2013/08/03/gradle-glassfish.html)
  
  ```
  /**
   *  ~/.gradle/gradle.properties:
   *  glassfishHome=/path/to/glassfish_home
   *
   *  or in Netbeans, right click project, Properties, Manage Build in Tasks, Run
   *  Add line to Arguments: -Dorg.gradle.project.glassfishHome=/path/to/glassfish_home
   *
   *  For more information about Exec tasks see
   *  http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.Exec.html
   */
  task run(dependsOn: 'war', type:Exec) {
      workingDir "${glassfishHome}${File.separator}bin"
  
      if (System.properties['os.name'].toLowerCase().contains('windows')) {
          commandLine 'cmd', '/c', 'asadmin.bat'
      } else {
          commandLine "./asadmin"
      }
  
      args "deploy", "--force=true", "${war.archivePath}"
  //from: https://www.schuermann.eu/2013/08/03/gradle-glassfish.html
  }
  
  ```
  
  In other words just use your asadmin
  
  > **Comments:**
  > **username_0**: I was thinking there might be a plug-in or API to interface with asadmin.  this is not such a typical task?  most use some other approach?  
  > **username_1**: Usually you will have some kind of CI(like jenkins) which will compile/deploy your code from repository. There are some plugins in gradle, but usually they just deploy to local/integrated glassfish instance. In Maven it is made by normal asadmin too.  
  
  ---
  
  