maven pom jetty run

简介:   构建一个 maven jetty 项目  demo下载   1. 配置 jetty 插件在pom中 4.0.0 com.curiousby.cn MavenJettyRunDemo 0.

 

构建一个 maven jetty 项目

 demo下载

 

1. 配置 jetty 插件在pom中

<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.curiousby.cn</groupId>
	<artifactId>MavenJettyRunDemo</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>war</packaging>

	<name>MavenJettyRunDemo</name>
	<url>http://maven.apache.org</url>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	</properties>

	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>3.8.1</version>
			<scope>test</scope>
		</dependency>
	</dependencies>


	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.3</version>
				<configuration>
					<source>1.7</source>
					<target>1.7</target>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>2.4.2</version>
				<configuration>
					<skipTests>false</skipTests>
					<testFailureIgnore>true</testFailureIgnore>
					<argLine>${argLine}</argLine>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.mortbay.jetty</groupId>
				<artifactId>jetty-maven-plugin</artifactId>
				<version>7.1.6.v20100715</version>
				<configuration>
					<webAppConfig>
						<contextPath>/jettyTest</contextPath>
					</webAppConfig>
					<connectors>
						<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
							<port>8084</port>
							<maxIdleTime>60000</maxIdleTime>
						</connector>
					</connectors>
				</configuration>
			</plugin>
		</plugins>
	</build>

</project>

  

2. web .xml 

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
	metadata-complete="true">

 
	<welcome-file-list>
		<welcome-file>index.jsp</welcome-file>
	</welcome-file-list>
</web-app>  

 

3. index.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

Hello world!
</body>
</html>

 

4. 运行 命令 maven bulid  -> mvn jetty:run 

 

 

或者  配置 

 



 

 

 

5.测试 



 

 6. 删除进程

在win 中 jetty 启动后进程未删除,导致后期的jetty  run 启动不起来,所以要删除 进程

 


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

捐助开发者

在兴趣的驱动下,写一个免费的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。 当然,有钱捧个钱场(右上角的爱心标志,支持支付宝和PayPal捐助),没钱捧个人场,谢谢各位。



 
 
 谢谢您的赞助,我会做的更好!

 

 

 

 

目录
相关文章
|
2月前
|
Java Maven
maven篇4:pom文件详解
maven篇4:pom文件详解
216 3
|
2月前
|
Java Maven 数据安全/隐私保护
弄懂maven仓库 & 仓库优先级 & settings & pom配置关系及差异
弄懂maven仓库 & 仓库优先级 & settings & pom配置关系及差异
851 1
|
2月前
|
Java API Maven
JFinal5+Jetty2009+IDEA2020+Java8的非Maven-Demo项目
JFinal5+Jetty2009+IDEA2020+Java8的非Maven-Demo项目
37 1
|
9月前
|
Java Maven
pom文件中引入本地jar包到maven项目
pom文件中引入本地jar包到maven项目
119 0
|
24天前
|
缓存 IDE Java
maven install报错原因揭秘:‘parent.relativePath‘指向错误的本地POM文件
在使用Maven构建项目时,遇到&#39;parent.relativePath&#39;错误通常是由于父项目POM路径设置错误、版本不一致或内容不匹配导致的。解决方法包括:校正父项目POM的相对路径、确保版本一致、保持POM文件内容同步,并排查其他潜在问题,如子模块命名冲突和Maven缓存问题。通过这些步骤可解决该错误,避免项目构建失败。
maven install报错原因揭秘:‘parent.relativePath‘指向错误的本地POM文件
|
2月前
|
Java Maven
idea中maven项目pom文件Could not acquire lock(s)
idea中maven项目pom文件Could not acquire lock(s)
476 2
|
8天前
|
Java Maven
Run HelloWorld using Maven(JavaFX)
Run HelloWorld using Maven(JavaFX)
8 1
|
2月前
|
XML Java Maven
Maven POM
Maven的POM(Project Object Model)是项目的基本配置文件,以XML格式描述项目信息、依赖、插件及构建细节。包含groupId、artifactId、version等必填字段,用于定义项目唯一标识和构建路径。POM还涉及目标执行、项目profile、开发者列表及邮件列表信息。在工作时,Maven通过读取POM获取配置并执行任务。
|
2月前
|
Java Maven
maven:the pom for XXX is missing, no dependency information available
maven:the pom for XXX is missing, no dependency information available
111 0
|
2月前
|
Java Maven
IDEA Maven SpringBoot配置POM文件
IDEA Maven SpringBoot配置POM文件
99 0