maven常用配置

[+]

eclipse 安装maven 插件

最好还是在marketplace处安装,不容易出现问题,当然,这种方式最大问题是速度慢,而且有时候网络连接经常断掉

help-eclipse marketplace打开,搜索maven 

安装第三个,如果要开发WEB项目,则还需要安装第一个。

配置jetty服务器

  1. <plugin>  
  2.   <groupId>org.mortbay.jetty</groupId>  
  3.   <artifactId>maven-jetty-plugin</artifactId>  
  4. </plugin>   

项目中加入这个,

然后jetty:run就可了。

使用maven添加JSTL支持

JSTL这个标签还是相当有用的。

最近的项目都是用MAVEN来搭建的,加上以下依赖就可以了:

  1. <!-- jstl -->  
  2.     <dependency>  
  3.           <groupId>javax.servlet</groupId>  
  4.           <artifactId>jstl</artifactId>  
  5.           <version>1.1.2</version>  
  6.           <type>jar</type>  
  7.       </dependency>  
  8.   
  9.   
  10.       <dependency>  
  11.           <groupId>taglibs</groupId>  
  12.           <artifactId>standard</artifactId>  
  13.           <version>1.1.2</version>  
  14.           <type>jar</type>  
  15.       </dependency>  

在JSP页面里加上:

  1. <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>  

于是就可以使用了:

例如:

  1. <c:forEach items="${webpages}" var="webpage">  
  2.             <li>  
  3.                 <c:out value="${webpage.url}"></c:out>  
  4.                 <c:out value="${webpage.time}"></c:out>  
  5.                 <a href="<c:url value="main/delete/${webpage.id}.htm"/>"><B>delete</B></a>  
  6.             </li>  
  7.         </c:forEach>  

使用maven添加quartz支持

如果在SPRING中使用,最好使用1.x系列,否则会报错“no setter found for property 'cronExpression' in class ......” ,SPRING的适配类适配的是1.X

  1. <dependency>  
  2.     <groupId>org.quartz-scheduler</groupId>  
  3.     <artifactId>quartz</artifactId>  
  4.     <version>2.1.6</version>  
  5. </dependency>  
  6. <dependency>  
  7.     <groupId>org.quartz-scheduler</groupId>  
  8.     <artifactId>quartz-oracle</artifactId>  
  9.     <version>2.1.6</version>  
  10. </dependency>  
  11. <dependency>  
  12.     <groupId>org.quartz-scheduler</groupId>  
  13.     <artifactId>quartz-weblogic</artifactId>  
  14.     <version>2.1.6</version>  
  15. </dependency>  
  16. <dependency>  
  17.     <groupId>org.quartz-scheduler</groupId>  
  18.     <artifactId>quartz-jboss</artifactId>  
  19.     <version>2.1.6</version>  
  20. </dependency>  

配置使用JDK 1.6

  1. <build>  
  2.         <plugins>  
  3.             <plugin>  
  4.                 <artifactId>maven-compiler-plugin</artifactId>  
  5.                 <version>2.3.2</version>  
  6.                 <configuration>  
  7.                     <source>1.6</source>  
  8.                     <target>1.6</target>  
  9.                 </configuration>  
  10.             </plugin>  
  11.         </plugins>  
  12.     </build>  

使用jsoup支持,当前版本1.7.1

  1. <dependency>  
  2.     <!-- jsoup HTML parser library @ http://jsoup.org/ -->  
  3.     <groupId>org.jsoup</groupId>  
  4.     <artifactId>jsoup</artifactId>  
  5.     <version>${jsoup.version}</version>  
  6. </dependency>  

[error]Could not get the value for parameter encoding for plugin execution default-resources  


删除用户目录.m2里内容,重新使用插件update

原文地址:https://www.cnblogs.com/zhaoxinshanwei/p/5767070.html