JDBC
package cn.danengmao.configure;
import java.sql.*;
public class JDBCUntils {
static {
try {
Class.forName("com.mysql.cj.jdbc.Driver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
public Connection Connection() throws SQLException {
Connection conn= DriverManager.getConnection("jdbc:mysql://localhost:3306/cqrk?serverTimezone=UTC&userUnicode=true&characterEncoding=utf-8&useSSL=false","root","root");
System.out.println("连接成功connection success");
return conn;
}
public void close(ResultSet rs, Connection conn, PreparedStatement ps){
if (rs!=null) {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (ps!=null) {
try {
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (conn!=null) {
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
过滤器
CheckLogin.java
package cn.danengmao.filter;
import cn.danengmao.Beans.User;
import cn.danengmao.service.UserServiceImpl;
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
@WebFilter("/success.jsp")
public class CheckLogin implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest req= (HttpServletRequest) servletRequest;
HttpServletResponse res= (HttpServletResponse) servletResponse;
servletRequest.setCharacterEncoding("UTF-8");
servletResponse.setCharacterEncoding("UTF-8");
servletResponse.setContentType("text/html;charset=UTF8");
User user = (User)req.getSession(true).getAttribute("user");
System.out.println(user.getUserid()+user.getUsername());
// System.out.println(Integer.parseInt((String)req.getSession(true).getAttribute("userrole")));
if(user==null) {
PrintWriter out = res.getWriter();
out.append("<script>");
out.append("alert('你没登录,给爷爬');");
out.append("location.href='index.jsp'");
out.append("</script>");
}else if(user.getRole()!=1){
PrintWriter out = res.getWriter();
out.append("<script>");
out.append("alert('你没权限,给爷爬');");
out.append("location.href='index.jsp'");
out.append("</script>");
}
else {
List<User> userList = null;
try {
userList = new UserServiceImpl().getAllUsers();
} catch (Exception e) {
e.printStackTrace();
}
req.setAttribute("userList", userList);
filterChain.doFilter(servletRequest,servletResponse);
}
}
@Override
public void destroy() {
}
}
Encoding.java
package cn.danengmao.filter;
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;
@WebFilter("/*")
public class EncodingFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
servletRequest.setCharacterEncoding("UTF-8");
servletResponse.setCharacterEncoding("UTF-8");
servletResponse.setContentType("text/html;charset=UTF8");
filterChain.doFilter(servletRequest,servletResponse);
}
@Override
public void destroy() {
}
}
servlet
package cn.danengmao.servlet;
import cn.danengmao.Beans.User;
import cn.danengmao.dao.UserDaoImpl;
import cn.danengmao.service.UserServiceImpl;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.sql.SQLException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
@WebServlet("/user")
public class Servlet extends HttpServlet {
@Override
protected void service(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException {
try {
String action = arg0.getParameter("action");
if ("modify".equals(action)) {
modifyPssById(arg0, arg1);
} else if ("remove".equals(action)) {
removerUserById(arg0, arg1);
} else if ("logout".equals(action)) {
logout(arg0, arg1);
} else if ("admin".equals(action)) {
modifyPass_admin(arg0, arg1);
} else if ("regist".equals(action)) {
regist(arg0, arg1);}
else if("ajax".equals(action)){
checkUsername_ajax(arg0, arg1);
}else {
login(arg0, arg1);
}
} catch (Exception e) {
e.printStackTrace();
}
}
//审核用户名是否已经存在如果存在就传参数no
protected void checkUsername_ajax(HttpServletRequest arg0, HttpServletResponse arg1) throws Exception {
String username=arg0.getParameter("username");
new UserServiceImpl().compareData(username,arg1);
}
protected void regist(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException {
String username = arg0.getParameter("username");
String password = arg0.getParameter("password");
String weight = arg0.getParameter("weight");
User user = new User();
user.setUsername(username);
user.setPassword(password);
user.setWeight(Double.parseDouble(weight));
int num = -1;
try {
num = new UserServiceImpl().regist(user);
} catch (Exception e) {
// 通常情况不允许屏蔽堆栈信息,如果要屏蔽掉堆栈信息时,必须进行相应的处理
/* e.printStackTrace(); */
System.err.println("用户名重复");
}
if (num > 0) {
// 注册成功后,直接就登录了---session
// 注册成功后,跳转到登陆页面进行登陆操作
arg0.setAttribute("registSuccess", "注册成功,请登录");
arg0.getRequestDispatcher("index.jsp").forward(arg0, arg1);
} else {
arg0.setAttribute("registDefeat", "注册失败,请重新注册");
arg0.getRequestDispatcher("regist.jsp").forward(arg0, arg1);
}
}
protected void modifyPass_admin(HttpServletRequest arg0, HttpServletResponse arg1) throws Exception {
System.out.println("admin");
String oldPass = arg0.getParameter("password");
System.out.println("shu ru de pass"+oldPass);
// 验证原始密码是否正确
User user = (User) arg0.getSession(true).getAttribute("user");
// Users user = new Users();
System.out.println("yuanbenmima"+user.getPassword());
// 理论上user.getPassword()==oldPass,但是不能直接获取,否则失去校验的意义
arg1.setContentType("text/html;charset=UTF8");
arg1.setCharacterEncoding("UTF-8");
if (oldPass.equals(user.getPassword())) {
System.out.println("正确");
// 原始密码正确,才能进行修改操作
String newPass = arg0.getParameter("newPass");
String id = arg0.getParameter("userid");
// 理论上session中的user对象已经包含了userid
user.setUserid(Integer.parseInt(id));
user.setPassword(newPass);
int num = new UserServiceImpl().modifyPass_admin(user);
if (num > 0) {
List<User> userList = new UserServiceImpl().getAllUsers();
arg0.setAttribute("userList", userList);
arg0.setAttribute("modifySuccess", "密码修改成功");
arg0.getRequestDispatcher("success.jsp").forward(arg0, arg1);
// 修改成功后是否需要重新登录取决您的业务
} else {
arg1.sendRedirect("500.jsp");
}
} else {
List<User> userList = new UserServiceImpl().getAllUsers();
arg0.setAttribute("userList", userList);
arg0.setAttribute("oldPassError", "原始密码不正确");
arg0.getRequestDispatcher("success.jsp").forward(arg0, arg1);
}
}
public void login(HttpServletRequest req, HttpServletResponse resp) throws UnsupportedEncodingException {
User user=new User();
user.setUsername( req.getParameter("username"));
user.setPassword(req.getParameter("password"));
req.setCharacterEncoding("UTF-8");
System.out.println("username"+user.getUsername());
UserServiceImpl userService=new UserServiceImpl();
try {
boolean flag=userService.Login(user);
int power=user.getRole();
System.out.println(power);
if (flag){
req.getSession(true).setAttribute("user", user);
List<User> userList = new UserServiceImpl().getAllUsers();
req.setAttribute("userList", userList);
if (power==1) {
req.getRequestDispatcher("success.jsp").forward(req, resp);
}else{
req.getRequestDispatcher("public.jsp").forward(req, resp);
}
}else {
req.setAttribute("user", user);
req.getRequestDispatcher("fail.jsp").forward(req, resp);
// resp.sendRedirect("fail.jsp");
}
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
protected void removerUserById(HttpServletRequest arg0, HttpServletResponse arg1)
throws NumberFormatException, Exception {
String userid = arg0.getParameter("id");
System.out.println(userid);
int num = new UserServiceImpl().removeUserById(Integer.parseInt(userid));
List<User> userList = new UserServiceImpl().getAllUsers();
arg0.setAttribute("userList", userList);
arg0.getRequestDispatcher("success.jsp").forward(arg0, arg1);
}
protected void logout(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException {
arg0.getSession(true).invalidate();
arg1.sendRedirect("index.jsp");
}
protected void modifyPssById(HttpServletRequest arg0, HttpServletResponse arg1) throws Exception {
String userid = arg0.getParameter("id");
System.out.println(userid);
String newPass = arg0.getParameter("newPass");
User user = new User();
user.setUserid(Integer.parseInt(userid));
user.setPassword(newPass);
int num = new UserServiceImpl().modifyPassById(user);
List<User> userList = new UserServiceImpl().getAllUsers();
arg0.setAttribute("userList", userList);
arg0.getRequestDispatcher("success.jsp").forward(arg0, arg1);
}
}
Dao层
package cn.danengmao.dao;
import cn.danengmao.Beans.User;
import cn.danengmao.configure.JDBCUntils;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
public class UserDaoImpl implements UserDao {
public UserDaoImpl() {
}
private static UserDaoImpl userDao = null;
public static UserDao getIntance() {
if (userDao == null) {
synchronized (UserDaoImpl.class) {
if (userDao == null) {
userDao = new UserDaoImpl();
}
}
}
return userDao;
}
//可能有错
@Override
public User selectOneUser(User user) throws SQLException {
JDBCUntils untils = new JDBCUntils();
Connection conn = untils.Connection();
PreparedStatement ps = conn.prepareStatement("select * from t_user where username=? and password=?");
ps.setString(1, user.getUsername());
ps.setString(2, user.getPassword());
ResultSet rs = ps.executeQuery();
while (rs.next()) {
int userid = rs.getInt(1);
String username = rs.getString(2);
String password = rs.getString(3);
double weight = rs.getDouble(4);
int role=rs.getInt(5);
System.out.println(userid + " " + username + " " + password + " " + weight+" "+role);
user.setUserid(userid);
user.setUsername(username);
user.setPassword(password);
user.setWeight(weight);
user.setRole(role);
}
untils.close(rs, conn, ps);
return user;
}
@Override
public List<User> getAllUsers() throws Exception {
JDBCUntils untils = new JDBCUntils();
Connection conn = untils.Connection();
PreparedStatement ps = conn.prepareStatement("select * from t_user ");
ResultSet rs = ps.executeQuery();
List userList = new ArrayList<>();
while (rs.next()) {
User user = new User();
user.setUserid(rs.getInt(1));
user.setUsername(rs.getString(2));
user.setWeight(rs.getDouble(4));
userList.add(user);
}
return userList;
}
@Override
public int removeUserById(int userid) throws Exception {
JDBCUntils untils = new JDBCUntils();
Connection conn = untils.Connection();
PreparedStatement ps = conn.prepareStatement("delete from t_user where userid=?");
ps.setInt(1, userid);
int num = ps.executeUpdate();
return num;
}
@Override
public int regist(User user) throws Exception {
JDBCUntils untils = new JDBCUntils();
Connection conn = untils.Connection();
String sql = "insert into t_user (username,password,weight) values(?,?,?)";
PreparedStatement ps = conn.prepareStatement(sql);
ps.setString(1, user.getUsername());
ps.setString(2, user.getPassword());
ps.setDouble(3, user.getWeight());
int num = ps.executeUpdate();
return num;
}
@Override
public int modifyPassById(User user) throws Exception {
JDBCUntils untils = new JDBCUntils();
Connection conn = untils.Connection();
PreparedStatement ps = conn.prepareStatement("update t_user set password=? where userid=?");
ps.setString(1, user.getPassword());
ps.setInt(2, user.getUserid());
int num = ps.executeUpdate();
return num;
}
@Override
public int modifyPass_admin(User user) throws Exception {
JDBCUntils untils = new JDBCUntils();
Connection conn = untils.Connection();
PreparedStatement ps = conn.prepareStatement("update t_user set password=? where userid=?");
ps.setString(1, user.getPassword());
ps.setInt(2, user.getUserid());
int num = ps.executeUpdate();
return num;
}
@Override
public int selectUserbyUsername(String username) throws SQLException {
JDBCUntils untils = new JDBCUntils();
Connection conn = untils.Connection();
PreparedStatement ps = conn.prepareStatement("select * from t_user where username=?");
ps.setString(1, username);
ResultSet rs = ps.executeQuery();
int userid=0;
while (rs.next()) {
userid = rs.getInt(1);
}
return userid;
}
}
Service层
package cn.danengmao.service;
import cn.danengmao.Beans.User;
import cn.danengmao.dao.UserDao;
import cn.danengmao.dao.UserDaoImpl;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
import java.io.Writer;
import java.sql.SQLException;
import java.util.List;
public class UserServiceImpl implements UserService {
private static final UserDao userDao = UserDaoImpl.getIntance();
@Override
public Boolean Login(User user) throws SQLException {
boolean flag=false;
userDao.selectOneUser(user);
if (user.getUserid()!=0){
flag=true;
return flag;
}
return flag;
}
@Override
public List<User> getAllUsers() throws Exception {
return userDao.getAllUsers();
}
@Override
public int removeUserById(int userid) throws Exception {
return userDao.removeUserById(userid);
}
@Override
public int modifyPassById(User user) throws Exception {
return userDao.modifyPassById(user);
}
@Override
public int modifyPass_admin(User user) throws Exception {
return userDao.modifyPass_admin(user);
}
@Override
public int regist(User user) throws Exception {
return userDao.regist(user);
}
@Override
public void compareData(String username,HttpServletResponse reps) throws Exception {
int num= userDao.selectUserbyUsername(username);
PrintWriter out=reps.getWriter();
if (num!=0){
out.append("no");
}else{
out.append("yes");
}
}
}
登录页
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" isELIgnored="false" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<style type="text/css">
span{color:red;}
</style>
</head>
<body>
<span style="color:red;"> ${registSuccess}</span>
<form action="/user" method="post">
<input type="hidden" name="role" value="${user.role}">
用户名称:<input name="username"><span>${loginError}</span><br>
用户密码:<input type="password" name="password"><br>
<input type="submit" value="登录">
<input type="reset" value="取消">
</form>
还没有账号?<a href="regist.jsp">注册</a>
</body>
</html>
### 修改密码
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" isELIgnored="false" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'modifyPass_admin.jsp.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<form action="user?action=admin" method="post">
<input type="hidden" name="userid" value="${user.userid}">
原始密码:<input type="password" name="password"><br/> <!-- 三次密码都输入正确,才能修改成功 -->
新密码:<input type="password"><br/><!-- 两次密码一致,进行前端校验 -->
确认密码:<input type="password" name="newPass"><br/>
<input type="submit" value="提交">
<input type="reset" value="取消">
</form>
</body>
</html>
### 成功后页面
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'success.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<style type="text/css">
span{margin-left:600px;}
table{width: 100%}
table,tr,th{border: 1px solid gray;border-collapse:collapse; }
#error{color:red;}
</style>
<script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
</head>
<body onload="timeTest()">
<span id="header"> <span id="error">${modifySuccess}${oldPassError}</span><label title="点击修改密码">${user.username}</label>,先生/女生
<a href="user?action=logout">【退出】</a>
</span>
<hr/>
<table>
<thead>
<tr><th>用户编号(不影响显示)</th><th>用户姓名</th><th>用户性别</th><th>操作</th></tr>
</thead>
<tbody>
<c:forEach items="${userList}" var="user">
<tr>
<th>${user.userid}</th>
<th>${user.username}</th>
<th>${user.weight}</th>
<th>
<button onclick="modifyPassById(${user.userid})">修改</button>
<button onclick="removerUserById(${user.userid})">删除</button>
</th>
</tr>
</c:forEach>
</tbody>
</table>
</body>
<script type="text/javascript">
$(function(){
$("tbody>tr").mouseover(function(){
$(this).css("background","gray");
}).mouseout(function(){
$(this).css("background","white");
});
$("label").click(function(){
location.href="${pageContext.request.contextPath}/modifyPass_admin.jsp";
});
})
function timeTest(){
i--;
clearin=setTimeout("timeTest()",1000);
if(i==0){
var $error=$("#error").html();
if($error!="" && $error!=null){
//$("p").css("display","none");
$("#error").hide();
clearTimeout(clearin);
}
}
}
function modifyPassById(id){
//URL传参
var newPass=prompt("请输入新密码");
if(newPass!=""){
location.href="user?action=modify&id="+id+"&newPass="+newPass;
}else{
alert("密码不能为空");
}
}
function removerUserById(id){
//URL传参
location.href="user?action=remove&id="+id;
}
function removerUserById(id){
//URL传参
location.href="user?action=remove&id="+id;
}
var i=4;
var clearin;
</script>
</html>
### 注册
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" isELIgnored="false" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<style type="text/css">
span{color:red;}
</style>
</head>
<body>
<span style="color:red;">${registDefeat}</span>
<form action="${pageContext.request.contextPath}/user?action=regist" method="post">
用户名称:<input id="username" onblur="ajaxSubmit()"><span id="state">${loginError}</span><br>
用户密码:<input type="password" id="password"><br>
用户性别:男<input type="radio" value="1" checked name="weight">
女<input type="radio" value="0" name="weight"><br>
<input type="submit" value="注册" id="regist">
<input type="reset" value="取消">
</form>
已有账号?<a href="index.jsp">登录</a>
</body>
<script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
<script>
function ajaxSubmit() {
$.ajax({
type:"post",
url:"user",
data:"action=ajax&username="+$("#username").val(),
success:function (arg) {
if (arg=="no") {
$("#state").html("<font color='red'>用户名已存在</font> ");
$("#regist").attr("disabled", true);
console.log('111')
}
else {
$("#state").html("<font color='green'>✔</font> ");
$("#submit").attr("disabled", false);
}
},
error:function () {
alert("失败");
}
})
}
</script>
</html>
POM.xml
<?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>org.example</groupId>
<artifactId>Xiangmu</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Xiangmu 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>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
</dependencies>
<build>
<finalName>Xiangmu</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.1.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.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>