Change name of generated war file and duplicate war file

gradle war include files
gradle war dependency
war plugin
gradle war plugin
gradle war plugin classpath
gradle war manifest
gradle war dependson
gradle build exploded war

i want to set the filename of the war task output before it is deployed to repository. e.g. project name is abc and originally it would result in abc-1.0.0-SNAPSHOT.war

But i want that there should be two generated war files with the same content:

  • def-1.0.0-SNAPSHOT.war
  • ghi-1.0.0-SNAPSHOT.war

task doPack(type: War, dependsOn: []) {
    archiveName "ROOT.war"

That worked for me

Tomcat: The Definitive Guide: The Definitive Guide, Copying the WAR file or webapp directory Probably the simplest way of deploying via and you write your build file to copy your webapp over to Tomcat once the webapp is built. Store "constants" here for easy change --> <property name="deploy.dir" When we run version two, it generates the WAR file the same way. In Gradle, the WAR plugin will generate the final WAR file with the following pattern: ${baseName}-${appendix}-${version}-${classifier}.${extension} Example : hello.1.0.war To change the default WAR filename, update war.archiveName. For example :


In build.gradle you can set the archive name:

war.archiveName "YOUR_SPECIAL_NAME.war"

gradle reference

The War Plugin, The War plugin extends the Java plugin to add support for assembling web application WAR files. It disables the default JAR archive generation of the Java  A war (web archive) File contains files of a web project. It may have servlet, xml, jsp, image, html, css, js etc. files. It may have servlet, xml, jsp, image, html, css, js etc. files. Here, we will discuss what is war file, how to create war file, how to deploy war file and how to extract war file.


Another one, for example:

war {
    baseName = 'service'
    version = '0.0.1-SNAPSHOT-' + System.currentTimeMillis();
}

Working With Files, You copy a file by creating an instance of Gradle's builtin Copy task and This example mimics copying a generated report into a directory that will be Gradle allows you to do this as part of a copy specification using the rename() configuration. files of the corresponding type (note that JAR, WAR and EAR files are ZIPs). WAR Files and Deployment As we described in the introduction to this chapter, a WAR file is an archive that contains all the parts of a web application: Java class … - Selection from Learning Java, 4th Edition [Book]


For gradle version 5 and above, they have deprecated properties 'baseName' and 'archiveName'.

So you can use 'archivesBaseName' instead.

war {
    archivesBaseName = 'name'
}  

buildWar, buildWar – the task of the CubaWarBuilding type, which builds a WAR file from However, separate WAR files contain some duplicated dependencies that increase overall size. appName - the name of the web application. These properties will be added to the /WEB-INF/local.app.properties files inside generated WAR. the WAR file to create. Exactly one of the two: warfile: Deprecated name of the file to create—use destfile instead. webxml: The servlet configuration descriptor to use (WEB-INF/web.xml). Yes, unless needxmlfile is true, the file is pulled in via a nested fileset, or an existing WAR file is being updated. needxmlfile


One more solution:

war {
    baseName = 'name'
    archiveName = "${baseName}.${extension}"
}

Learning Modular Java Programming, To copy the URL for the repository in VisualSVN, we need to right-click on the add, and update the data to and from the repository visual-repo1 which we have To copy a WAR file of our application, first of all we need to generate the WAR​  This Maven Tutorial focuses on maven-war-plugin. Our requirement here is to generate single .war file using Maven which you could run on Apache Tomcat or any other web container. Let’s get started: Create Dynamic Web Project in Eclipse, i.e. CrunchifyTutorial; Create simple .java file into your project, i.e. CrunchifyWarUsingMaven.java


The Definitive Guide to Grails 2, You can change the version number by calling the set-version command, Using Application Metadata Version <g:meta name="app.version"/> Built with If you want to customize the way in which the WAR file is produced, you can You can then use custom copy steps to include whatever extra resources you need. The War plugin extends the Java plugin to add support for assembling web application WAR files. It disables the default JAR archive generation of the Java plugin and adds a default WAR archive task. It disables the default JAR archive generation of the Java plugin and adds a default WAR archive task.


Java Server Programming Java Ee5 Black Book, Platinum Ed (With Cd), The ant glassfish command generates the UserLogin . war file , which is stored in the build Copy this WAR file from the build folder ( C : \ jboss - seam2 . To start the server , change the working directory to the bin subdirectory , where war / deployment failed Object Name : jboss . web . deployment : war = jboss - seam  Classifier to add to the generated WAR. If given, the artifact will be an attachment instead. The classifier will not be applied to the JAR file of the project - only to the WAR file. <containerConfigXML> File-The path to a configuration file for the servlet container. Note that the file name may be different for different servlet containers.


J2EE and JAX: Developing Web Applications and Web Services, Copy the file FavoriteTeamScriptlet.jsp into the context directory of the serv- let. Update the WAR file with the following command: jar –uf nfl.war FavoriteTeamScriptlet.jsp 3. Listing 6.4 shows the servlet that is generated from this JSP. After all, WAR file, like JAR file is just another ZIP file. The WAR task is an extension to the JAR task, but it has some nice additions to manipulate what goes into the WEB-INF/classes folder, and generating the web.xml file. The WAR task is useful to specify a particular layout of the WAR file. Since the WAR task is an extension of the JAR