Maven使用常见问题

1、更新eclipse的classpath加入新依赖
1、在dependencyManagement里面加入包括版本在内的依赖信息,如: 
<dependency> 
<groupId>joda-time</groupId> 
<artifactId>joda-time</artifactId> 
<version>1.6.2</version> 
</dependency> 
2、在同级的
dependencies
节点里面加入该依赖,如: 
<dependency> 
<groupId>joda-time</groupId> 
<artifactId>joda-time</artifactId> 
</dependency> 
3、使用mvn eclipse:clean删除当前的工程配置文件,并用mvn eclipse:eclipse重新生成。 
4、导入或刷新该eclipse工程。

2、工程配置未使用pom.xml更新问题:
Project configuration is not up-to-date with pom.xml 导入maven工程后,出现如下错误: 
Description Resource Path Location Type Project configuration is not up-to-date with pom.xml. Run project configuration update rdc line 1 Maven Configuration Problem
解决办法就是: 
右键项目,【Maven】--》【Update Project Configuration...】即可。。。
3、如何修改默认GBK的资源过滤Using platform encoding (GBK actually) to copy filtered resources 需要指定字符集: 
<plugin> 
<groupId>org.apache.maven.plugins</groupId> 
<artifactId>maven-resources-plugin</artifactId> 
<version>2.2</version> 
<configuration> 
<encoding>UTF-8</encoding> 
</configuration> 
</plugin>
4、不支持范型的JDK版本问题maven打包时始终出现TripApplyAction.java:[267,6]-source 1.3中不支持泛型(请使用-source 5或更高版 本以启用泛型)Map<String, Object> map = new HashMap<String, Object>(); 解决方法,指定JDK版本: 在pom.xml文件中加入下一面一段语句来指定所用的版本,尽管在eclipse中配置了正确的“Build Path”: 
<build> 
<plugins> 
<plugin> 
<artifactId>maven-compiler-plugin</artifactId> 
<configuration> 
<target>1.5</target> 
<source>1.5</source> 
<encoding>UTF-8</encoding> 
</configuration> 
</plugin> 
</plugins> 
</build> 
重新运行mvn clean eclipse:eclipse -Dmaven.test.skip=true,接着mvn package,问题解决。
5、如何在使用命令方式下载依赖的同时下载源码
1. 使用maven命令:mvn dependency:sources 下载依赖包的源代码。 
2. 使用参数: -DdownloadSources=true 下载源代码jar。 -DdownloadJavadocs=true 下载javadoc包。
7、maven打包,忽略test的参数mvn -Dmaven.test.failure.ignore=true package mvn -Dmaven.test.skip=true clean package
8、web.xml which will be ignored[WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ignored (webxml attribute is missing from war ask, or ignoreWebxml attribute is specified as ‘true‘)在使用Maven 编译项目的时候会出现 [WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ignored 
解决方法: 
<plugin> 
<groupId>org.apache.maven.plugins</groupId> 
<artifactId>maven-war-plugin</artifactId> 
<version>2.1.1</version> 
<configuration> 
<!-- 
http://maven.apache.org/plugins/maven-war-plugin/ 
--> 
<packagingExcludes>WEB-INF/web.xml</packagingExcludes> 
</configuration> 
</plugin>
9、Maven3.04暂时不支持Servlet3的无web.xml形式[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war(default-war) on project prospringmvc01: Error assembling WAR: webxml attribute is required (orpre-existing WEB-INF/web.xml if executing in update mode) ->

时间: 2024-07-29 10:06:50

Maven使用常见问题的相关文章

Maven使用常见问题整理

Maven使用常见问题整理  1.更新eclipse的classpath加入新依赖  1.在dependencyManagement里面加入包括版本在内的依赖信息,如:   <dependency>    <groupId>joda-time</groupId>    <artifactId>joda-time</artifactId>    <version>1.6.2</version>   </dependen

Eclipse、maven项目常见问题

阿里云maven仓库地址: <mirror> <id>nexus-aliyun</id> <mirrorOf>*</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror> 只需在在maven的settings.xml 文件里配置

初识Idea,部署Maven项目常见问题解决方案

一.idea 中项目右键没有run命令选项,没有maven的clean与install选项 解决方案:安装Maven Helper插件 二.Idea不识别java文件(类文件显示橙色) 解决方案: 第一步:点击File,Project Structure 第二步:Modules里 将Content Root 删除再添加 三.如何编译maven工程 Maven Build 解决方案: 第一步:Help-Find Acion..输入maven projects 第二步:在mave项目的Lifecyc

Maven安装及使用中的常见问题

环境:win7  +    eclipse mars版本 一.安装maven 1.安装maven插件 1).下载maven并解压到指定目录,到该目录下复制当前路径path 2).在eclipse的dropins目录下编辑maven.link,将maven所在的path填写进去: path=D:/Program Files/DevTools/apache-maven-3.3.9 然后启动eclipse,在Window-->Prefrence窗口看到Maven的选项说明maven插件安装成功. 2.

jenkins+docker+portainer搭建持续集成环境

该demo基于centos7环境 说明: 准备2台以上服务器,该demo准备了master和node两台服务器192.168.10.17(master) 192.168.10.16(node) 所有服务器均安装docke jenkins portainer安装在master节点上 eureka和zuul网关部署在master节点上 springboot-service-a/springboot-service-b/springboot-service-c部署在node节点上 网关作为同一的访问入

maven常见问题问答(转)

转自:http://www.oschina.net/question/158170_29368 1.前言 Maven,发音是[`meivin],"专家"的 意思.它是一个很好的项目管理工具,很早就进入了我的必备工具行列,但是这次为了把project1项目完全迁移并应用maven,所以对maven进行 了一些深入的学习.写这个学习笔记的目的,一个是为了自己备忘,二则希望能够为其他人学习使用maven 缩短一些时间. 2. maven概要 首先我把maven的概念快速的梳理一下,让我们快速

maven常见问题

1.指定jre版本,方法有很多,我比较喜欢用POM中指定 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <target>1.6</target> <so

有关使用Maven常见问题总结(Eclipse中使用Maven、Maven项目部署到tomcat等问题)

最近一些项目需要让Maven来管理,一种情况是将之前的eclipse的Java Project项目和Web project 加入Maven管理,还有一种情况是,将SVN上的Maven项目拉到本地,在eclipse中使用时遇到的一些棘手问题,问题过程和解决具体方案如下: 1.在eclipse中安装maven插件后启动eclipse时,会遇到如下警告: The Maven Integration requires that Eclipse be running in a JDK, because a

Spring Boot常见问题(一)Maven依赖加载失败

最近两天学习Spring Boot过程中,pom.xml文件老是报错.最终发现,是Maven加载依赖失败的缘故.Maven部分包加载失败时,如何重新加载这些包,下面提供简单的解决方式.