diff options
| author | Kamal Wickramanayake <kamal@inbox.lk> | 2026-03-28 21:06:57 +0530 |
|---|---|---|
| committer | Kamal Wickramanayake <kamal@inbox.lk> | 2026-03-28 21:06:57 +0530 |
| commit | dfc57517c8fd60f862029d95c25aa01410578c69 (patch) | |
| tree | b9b71e5516c3280564507c7432dedd75cba60acf | |
| parent | a405bf7f782f916236a9afd238eb50317fac2bf6 (diff) | |
Added hello webapp sample application
| -rw-r--r-- | maven/02-hello-webapp/.gitignore | 1 | ||||
| -rw-r--r-- | maven/02-hello-webapp/.mvn/jvm.config | 0 | ||||
| -rw-r--r-- | maven/02-hello-webapp/.mvn/maven.config | 0 | ||||
| -rw-r--r-- | maven/02-hello-webapp/README | 11 | ||||
| -rw-r--r-- | maven/02-hello-webapp/pom.xml | 67 | ||||
| -rw-r--r-- | maven/02-hello-webapp/src/main/webapp/WEB-INF/web.xml | 10 | ||||
| -rw-r--r-- | maven/02-hello-webapp/src/main/webapp/index.jsp | 5 |
7 files changed, 94 insertions, 0 deletions
diff --git a/maven/02-hello-webapp/.gitignore b/maven/02-hello-webapp/.gitignore new file mode 100644 index 0000000..eb5a316 --- /dev/null +++ b/maven/02-hello-webapp/.gitignore @@ -0,0 +1 @@ +target diff --git a/maven/02-hello-webapp/.mvn/jvm.config b/maven/02-hello-webapp/.mvn/jvm.config new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/maven/02-hello-webapp/.mvn/jvm.config diff --git a/maven/02-hello-webapp/.mvn/maven.config b/maven/02-hello-webapp/.mvn/maven.config new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/maven/02-hello-webapp/.mvn/maven.config diff --git a/maven/02-hello-webapp/README b/maven/02-hello-webapp/README new file mode 100644 index 0000000..2f95e85 --- /dev/null +++ b/maven/02-hello-webapp/README @@ -0,0 +1,11 @@ +mvn archetype:generate + +Select org.apache.maven.archetypes:maven-archetype-webapp as the archetype. + +Run below command to generate a .war file (web application archive) + + mvn clean package + +Copy the generated hello.war file (inside the target directory) to the webapps directory of Tomcat installation. + +Access the URL: http://localhost:8080/hello/ diff --git a/maven/02-hello-webapp/pom.xml b/maven/02-hello-webapp/pom.xml new file mode 100644 index 0000000..469ed31 --- /dev/null +++ b/maven/02-hello-webapp/pom.xml @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>com.example.test</groupId> + <artifactId>hello</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>war</packaging> + + <name>hello Maven Webapp</name> + <!-- FIXME change it to the project's website --> + <url>http://www.example.com</url> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <maven.compiler.source>8</maven.compiler.source> + <maven.compiler.target>8</maven.compiler.target> + </properties> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.13.1</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <finalName>hello</finalName> + <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --> + <plugins> + <plugin> + <artifactId>maven-clean-plugin</artifactId> + <version>3.4.0</version> + </plugin> + <!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging --> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <version>3.3.1</version> + </plugin> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.13.0</version> + </plugin> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <version>3.3.0</version> + </plugin> + <plugin> + <artifactId>maven-war-plugin</artifactId> + <version>3.4.0</version> + </plugin> + <plugin> + <artifactId>maven-install-plugin</artifactId> + <version>3.1.2</version> + </plugin> + <plugin> + <artifactId>maven-deploy-plugin</artifactId> + <version>3.1.2</version> + </plugin> + </plugins> + </pluginManagement> + </build> +</project> diff --git a/maven/02-hello-webapp/src/main/webapp/WEB-INF/web.xml b/maven/02-hello-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..b9c921f --- /dev/null +++ b/maven/02-hello-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<web-app + version="4.0" + xmlns="http://xmlns.jcp.org/xml/ns/javaee" + xmlns:javaee="http://xmlns.jcp.org/xml/ns/javaee" + xmlns:xml="http://www.w3.org/XML/1998/namespace" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"> + <display-name>Archetype Created Web Application</display-name> +</web-app> diff --git a/maven/02-hello-webapp/src/main/webapp/index.jsp b/maven/02-hello-webapp/src/main/webapp/index.jsp new file mode 100644 index 0000000..ee89d62 --- /dev/null +++ b/maven/02-hello-webapp/src/main/webapp/index.jsp @@ -0,0 +1,5 @@ +<html> +<body> +<h2><%= "Hello World!" %></h2> +</body> +</html> |
