背景:总结maven使用过程中的相关问题,方便以后查询!
1 问题汇总- 今天在导入github上下载的maven项目时候,出现了一堆错误,一时间不知道该如何下手。
根据错误提示,发现是一些依赖的jar包无法下载,到本地仓库中查看,这些jar包确实不存在。最终采用在网上手动下载的方法解决上述问题。
ps:出现jar包依赖无法下载,可能是网络问题,或者仓库问题,最好是手动下载,然后放在本地仓库!
maven打包各种警告,打包失败
警告: 没有 @return
警告: repayedPrplAmt没有 @param
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.9</version> <configuration> <aggregate>true</aggregate> <charset>UTF-8</charset> <encoding>UTF-8</encoding> <docencoding>UTF-8</docencoding> </configuration> <executions> <execution> <id>attach-javadocs</id> <goals> <goal>jar</goal> </goals> <configuration> <additionalparam>-Xdoclint:none</additionalparam> </configuration> </execution> </executions> </plugin>
在插件中加入上述代码即可
如果还是失败,直接使用如下maven命令
clean install -Dadditionalparam=-Xdoclint:none
https://github.com/knightliao/disconf/issues/317
idea操作maven时控制台中文显示乱码/maven项目启动方式
idea操作maven时控制台中文显示乱码/maven项目启动方式
Setting->maven->runner VMoptions:
-Dfile.encoding=GB2312
Compilation failure: Compilation failure:
[exec] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project zjlh-amdpds-server: Compilation failure: Compilation failure: [exec] [ERROR] \GitWorkPlace\project-builds\pds\temp\amd-server\zjlh-amdpds-server\src\main\java\com\hd123\zjlh\amd\pds\mdm\service\AmdOperatorServiceImpl.java:[85,36] 错误: 找不到符号 [exec] [ERROR] \GitWorkPlace\project-builds\pds\temp\amd-server\zjlh-amdpds-server\src\main\java\com\hd123\zjlh\amd\pds\mdm\service\AmdOperatorServiceImpl.java:[119,36] 错误: 找不到符号 [exec] [ERROR] \GitWorkPlace\project-builds\pds\temp\amd-server\zjlh-amdpds-server\src\main\java\com\hd123\zjlh\amd\pds\mdm\dao\operator\OperatorQueryProcessorProvider.java:[24,34] 错误: 找不到符号
这里出现找不到符号,install失败,原因是mvan中 B依赖的模块A发生变更,但是A没有install,导致B install失败
方案:A模块install一次就可以了
java.lang.UnsupportedClassVersionError: javax/validation/constraints/Min : Unsupported major.minor version 52.0
[问题记录]Unsupported major.minor version 52.0
单元测试中报错
目前查到的原因是idea中jdk版本过低,
Go to Maven Settings -> Maven -> Importing. Set the JDK for importer to 1.8
Go to Maven Settings -> Maven -> Runner. Set the JRE to 1.8
Go to File -> Project Structure -> SDKs. Make sure the JDK home path is set to 1.8
当时一直出现这个原因是因为maven中importing中的jdk版本一直没有变更导致的。
如果修改后还是出现该问题,可以考虑重新打开一个project
ps:如果以上三步都不生效,那就使用终极大杀招——Go to File -> Project Structure -> SDKs中删除jdk1.8的相关配置
Maven经典错误之三:was cached in the local repository, resolution will not be reattempted until the upda
Maven经典错误之三:was cached in the local repository, resolution will not be reattempted until the upda
将本地Maven仓库中已下载的相关依赖Jar删掉,从新build update工程即可.!
Maven deploy时候出错
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project wf-cashloan-common: Failed to deploy artifacts: Could not transfer artifact com.jd.jr.cashloan.common:wf-cashloan-common:jar:1.0.19 from/to releases (http://nexus.cbpmgt.com/nexus/content/repositories/releases): Failed to transfer file: http://nexus.cbpmgt.com/nexus/content/repositories/releases/com/jd/jr/cashloan/common/wf-cashloan-common/1.0.19/wf-cashloan-common-1.0.19.jar. Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]
错误的原因是在本地不能deploy正式版本的组件,只能发快照版本。在JCI上面才能发布正式版本的组件
<version>1.0.19-SNAPSHOT</version>