WAR plugin: project layout is missing

how do I get the proper structure for a web app?

nicholas@mordor:~/NetBeansProjects/make_war$ 
nicholas@mordor:~/NetBeansProjects/make_war$ pwd
/home/nicholas/NetBeansProjects/make_war
nicholas@mordor:~/NetBeansProjects/make_war$ 
nicholas@mordor:~/NetBeansProjects/make_war$ ls
nicholas@mordor:~/NetBeansProjects/make_war$ 
nicholas@mordor:~/NetBeansProjects/make_war$ gradle init

Select type of project to generate:
  1: basic
  2: application
  3: library
  4: Gradle plugin
Enter selection (default: basic) [1..4] 2

Select implementation language:
  1: C++
  2: Groovy
  3: Java
  4: Kotlin
  5: Scala
  6: Swift
Enter selection (default: Java) [1..6] 3

Split functionality across multiple subprojects?:
  1: no - only one application project
  2: yes - application and library projects
Enter selection (default: no - only one application project) [1..2] 1

Select build script DSL:
  1: Groovy
  2: Kotlin
Enter selection (default: Groovy) [1..2] 1

Select test framework:
  1: JUnit 4
  2: TestNG
  3: Spock
  4: JUnit Jupiter
Enter selection (default: JUnit 4) [1..4] 2

Project name (default: make_war): 
Source package (default: make_war): 

> Task :init
Get more help with your project: https://docs.gradle.org/7.0.2/samples/sample_building_java_applications.html

BUILD SUCCESSFUL in 23s
2 actionable tasks: 2 executed
nicholas@mordor:~/NetBeansProjects/make_war$ 
nicholas@mordor:~/NetBeansProjects/make_war$ tree
.
├── app
│   ├── build.gradle
│   └── src
│       ├── main
│       │   ├── java
│       │   │   └── make_war
│       │   │       └── App.java
│       │   └── resources
│       └── test
│           ├── java
│           │   └── make_war
│           │       └── AppTest.java
│           └── resources
├── gradle
│   └── wrapper
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle

12 directories, 8 files
nicholas@mordor:~/NetBeansProjects/make_war$ 
nicholas@mordor:~/NetBeansProjects/make_war$ nano app/build.gradle 
nicholas@mordor:~/NetBeansProjects/make_war$ 
nicholas@mordor:~/NetBeansProjects/make_war$ cat app/build.gradle 
/*
 * This file was generated by the Gradle 'init' task.
 *
 * This generated file contains a sample Java application project to get you started.
 * For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle
 * User Manual available at https://docs.gradle.org/7.0.2/userguide/building_java_projects.html
 */

plugins {
    // Apply the application plugin to add support for building a CLI application in Java.
    id 'application'
    id 'war'
}

repositories {
    // Use Maven Central for resolving dependencies.
    mavenCentral()
}

dependencies {
    // Use TestNG framework, also requires calling test.useTestNG() below
    testImplementation 'org.testng:testng:7.3.0'

    // This dependency is used by the application.
    implementation 'com.google.guava:guava:30.0-jre'
}

application {
    // Define the main class for the application.
    mainClass = 'make_war.App'
}

tasks.named('test') {
    // Use TestNG for unit tests.
    useTestNG()
}


nicholas@mordor:~/NetBeansProjects/make_war$ 
nicholas@mordor:~/NetBeansProjects/make_war$ gradle clean war

BUILD SUCCESSFUL in 902ms
3 actionable tasks: 3 executed
nicholas@mordor:~/NetBeansProjects/make_war$ 
nicholas@mordor:~/NetBeansProjects/make_war$ tree
.
├── app
│   ├── build
│   │   ├── classes
│   │   │   └── java
│   │   │       └── main
│   │   │           └── make_war
│   │   │               └── App.class
│   │   ├── generated
│   │   │   └── sources
│   │   │       ├── annotationProcessor
│   │   │       │   └── java
│   │   │       │       └── main
│   │   │       └── headers
│   │   │           └── java
│   │   │               └── main
│   │   ├── libs
│   │   │   └── app.war
│   │   └── tmp
│   │       ├── compileJava
│   │       │   └── source-classes-mapping.txt
│   │       └── war
│   │           └── MANIFEST.MF
│   ├── build.gradle
│   └── src
│       ├── main
│       │   ├── java
│       │   │   └── make_war
│       │   │       └── App.java
│       │   └── resources
│       └── test
│           ├── java
│           │   └── make_war
│           │       └── AppTest.java
│           └── resources
├── gradle
│   └── wrapper
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle

29 directories, 12 files
nicholas@mordor:~/NetBeansProjects/make_war$ 


the documentation here:

https://docs.gradle.org/current/userguide/war_plugin.html

states that:

Project layout

In addition to the standard Java project layout, the War Plugin adds:

src/main/webapp

Web application sources

does it? really? how?

I can see how the text could be misleading. The plugin does not create the directory src/main/webapp, you need to do that yourself.
The plugin is configured with the default settings/convention that content located in /src/main/webapp is copied into the war file.

well, okay – can’t see why gradle wouldn’t create that skeleton structure during “init” tho. Good to know.

The war plugin was something extra you added to the project after using init, correct? If that’s true then I’m not sure what init could have done to anticipate your intentions, or are you suggesting a feature should be added to the init task for war support?