运行maven遇到的坑,差点崩溃了。
参考链接1:https://blog.csdn.net/lch_cn/article/details/8225448/
参考链接2:https://jingyan.baidu.com/article/ad310e80ef28c81849f49e16.html
异常1:
[ERROR] Failed to execute goal on project biz_zhuhai: Could not resolve dependencies for project biz_zhuhai:biz_zhuhai:jar:0.0.1-SNAPSHOT: Failed to collect dependencies for [com.maywide.ibh:lib345:pom:1.0 (compile)]: Failed to read artifact descriptor for com.maywide.ibh:lib345:pom:1.0: Could not transfer artifact com.maywide.ibh:lib345:pom:1.0 from/to releases (http://localhost:9888/nexus-2.0.3/content/repositories/releases): Connection to http://localhost:9888 refused: Connection refused: connect -> [Help 1]
解决方法:
这是配置的url有错误或者是私服没有配好,导致构件下载时出错。如果没有jar包需要在私服里下载,可以不配置私服的,也就是可以把setting.xml的profiles里的东西全部删除的。
异常2:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test) on project web_nanchang: There are test failures.
[ERROR]
[ERROR] Please refer to E:\maven\web_nanchang\target\surefire-reports for the individual test results.
解决方法:
这是因为测试代码时遇到错误,它会停止编译。只需要在pom.xml的<project>里添加以下配置,使得测试出错不影响项目的编译。
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</build>
异常3:
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.0.6:start (start-container) on project myproject: Execution start-container of goal org.codehaus.cargo:cargo-maven2-plugin:1.0.6:start failed: Error while expanding C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\cargo\installs\apache-tomcat-6.0.29.zip
[ERROR] java.io.IOException: Negative seek offset
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutio
nException
解决方法:
自己下载“apache-tomcat-6.0.29.zip”,将下载好的文件拷贝到指定文件夹“C:\Documents and Settings\Administrator\Local Settings\Temp\cargo\installs”下。
异常4:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project web_nanchang: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
解决方法:
maven的web项目默认的webroot是在src\main\webapp。如果在此目录下找不到web.xml就抛出以上的异常。解决方法在pom.xml加入以下的配置。红色字体改成你网站的根目录。
<build>
<finalName>simple-webapp</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<webResources>
<resource>
<!-- this is relative to the pom.xml directory -->
<directory>WebContent</directory>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
Maven下载jar包出现.lastUpdated结尾的文件问题及解决
原文链接:https://blog.csdn.net/qq784515681/article/details/88739188
出错原因
出现.lastUpdated结尾的文件的原因:由于网络原因没有将Maven的依赖下载完整导致。
解决方案:
有私服地址的情况下:
1、删除所有以.lastUpdate结尾的文件
a) 切换到maven的本地仓库
b) 在当前目录打开cmd命令行
c) Windows执行命令:for /r %i in (*.lastUpdated) do del %i
d) Linux执行命令:
find /app/maven/localRepository -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;
补充:
IntelliJ IDEA如何重新下载已删除的maven依赖包?
右键项目 -》 下拉找到Maven -》 选择Reimport即可。
第二个解决jar包无法加载的问题。
第一个方法:删除本地的\repository库中所有.lastupdate后缀文件 以及sha1-in-progress为后缀的文件,重新下载
当我们使用eclipse下载jar包,有事突然退出,再次进入jar包还是下载不起
可能的原因就是 maven没有将jar下载完时,会生成一个.lastupdate文件
在校验sha1码未完成时会生成sha1-in-progress为后缀的文件
解决方法: 使用文件搜索工具(楼主用的是 Everything) 输入.lastupdate删除所有以.lastupdate结尾的文件;
输入sha1-in-progress删除所有以sha1-in-progress结尾的文件。
然后简单修改.pom(比如加空格) 保存,然后eclipse就会重新下载jar包!
第二个办法:maven添加镜像地址,编辑maven根目录中conf文件夹下settings.xml
在 mirrors中增加
<mirrors>
<mirror>
<id>ibiblio.org</id>
<name>ibiblio Mirror of http://repo1.maven.org/maven2/</name>
<url>http://mirrors.ibiblio.org/pub/mirrors/maven2</url>
<mirrorOf>central</mirrorOf>
<!-- United States, North Carolina -->
</mirror>
<mirror>
<id>jboss-public-repository-group</id>
<mirrorOf>central</mirrorOf>
<name>JBoss Public Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public</url>
</mirror>
</mirrors></span>
添加保存后,重新编辑pom文件,加个空格什么的,能下载部分jar包,还是有一些jar不能下载
第三个办法:拷贝相应jar,手动导入本地库
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>
Maven 安装 JAR 包的命令是:
mvn install:install-file -Dfile=jar包的位置 -DgroupId=上面的groupId -DartifactId=上面的artifactId -Dversion=上面的version -Dpackaging=jar
如何手动获取jar包,
1、通过 在http://mvnrepository.com/中查询到相应的jar包的, 如查询 Sqljdbc4
2、得到如下的maven
<!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/sqljdbc4 -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
<scope>test</scope>
</dependency>
可以通过输入http://clojars.org/repo/ 到浏览器,通过groupId 和 artifactId以及版本号,查询到jar包,然后下载到本地即可
linux下
~/.m2 -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;
cd %userprofile%\.m2\repository
for /r %i in (*.lastUpdated) do del %i
然后右击你的工程,Maven->”Update Project …”,即可解决。
---------------------
作者:ckxuexixuexi
来源:CSDN
原文:https://blog.csdn.net/ckxuexixuexi/article/details/80824203
运行maven遇到的坑,差点崩溃了。的更多相关文章
- eclipse构建及运行maven web项目
1:环境 eclipse indigo, JDK1.6, maven 3.2.1, tomcat7.0.42 2:安装eclipse maven插件 m2eclipse 第一种方法:从网上下载m2ec ...
- 运行 maven install的时候出现错误 not a jre
原文转自jingyan.baidu.com/article/c85b7a6464d8be003bac95fb.html (linux下我直接执行第二步,错误解决) 在使用eclipse 运行 mave ...
- eclipse清除运行Maven build...后积累的配置项
1.使用eclipse运行maven命令,经常会积累很多的配置项. 2.清理配置项同样在 Run As ---> Run configurations...中.
- Mac下hadoop运行word count的坑
Mac下hadoop运行word count的坑 Word count体现了Map Reduce的经典思想,是分布式计算中中的hello world.然而博主很幸运地遇到了Mac下特有的问题Mkdir ...
- eclipse 创建并运行maven web项目
这两天想在eclipse上运行maven web项目,折腾了许久,总算success啦. 1,利用eclipse创建dynamic web project(eclipse需要安装m2eclipse). ...
- Torch-RNN运行过程中的坑 [2](Lua的string sub函数,读取中文失败,乱码?)
0.踩坑背景 仍然是torch-rnn/LanguageModel.lua文件中的一些问题,仍然是这个狗血的LM:encode_string函数: function LM:encode_string( ...
- Torch-RNN运行过程中的坑 [1](读取Lua非空table,size为0)
0.踩坑背景 执行Torch-RNN的时候,在LanguageModel.lua中的encode_string函数中,对start_text的各个character进行id映射编码,实现功能类似“北京 ...
- Torch-RNN运行过程中的坑 [0](一些基础概念)
0.Lua & LuaJIT简介 Lua 是一种轻量小巧的脚本语言,用标准C语言编写并以源代码形式开放, 其设计目的是为了嵌入应用程序中,从而为应用程序提供灵活的扩展和定制功能. Lua 是巴 ...
- 运行maven build报错No goals have been specified for this build.
运行maven报错: [ERROR] No goals have been specified for this build. You must specify a valid lifecycle p ...
随机推荐
- Spring 启动脚本
if [ $# != 3 ];then echo 'option-1: start,stop or restart.' echo 'option-2: 请传入jar路径' echo 'option-3 ...
- VXLAN配置实例(华为)
常用命令总结: bridge-domain bd-id,创建广播域BD,并进入BD视图. description description,配置BD的描述信息. l2 binding vlan vlan ...
- jvm系列五-java内存模型(2)
原作者系列文章链接:并发编程系列博客传送门 前言# 在网上看了很多文章,也看了好几本书中关于JMM的介绍,我发现JMM确实是Java中比较难以理解的概念.网上很多文章中关于JMM的介绍要么是照搬了一些 ...
- Flink-v1.12官方网站翻译-P007-Data Pipelines & ETL
数据管道和ETL 对于Apache Flink来说,一个非常常见的用例是实现ETL(提取.转换.加载)管道,从一个或多个源中获取数据,进行一些转换和/或丰富,然后将结果存储在某个地方.在这一节中,我们 ...
- C++快读
写在前面: 一个小专题 完全非原创,不知道原来是谁提出的 诈尸 http://thepingaslord.deviantart.com/art/The-Evening-Prior-312446336 ...
- 主席树 【权值线段树】 && 例题K-th Number POJ - 2104
一.主席树与权值线段树区别 主席树是由许多权值线段树构成,单独的权值线段树只能解决寻找整个区间第k大/小值问题(什么叫整个区间,比如你对区间[1,8]建立一颗对应权值线段树,那么你不能询问区间[2,5 ...
- C# TextBlock
TextBlock 适合长文本多行显示,Label可以看成是一个简短的单行的TextBlock,只是Label可以显示图片,TextBlock只能显示纯文本 默认的文本不会分行显示,超出窗体宽度的字符 ...
- Splunk监控软件操作
一. Splunk公司与产品 美国Splunk公司,成立于2004年,2012年纳斯达克上市,第一家大数据上市公司,荣获众多奖项和殊荣.总部位于美国旧金山,伦敦为国际总部,香港设有亚太支持中心,上海 ...
- python 爬取腾讯视频的全部评论
一.网址分析 查阅了网上的大部分资料,大概都是通过抓包获取.但是抓包有点麻烦,尝试了F12,也可以获取到评论.以电视剧<在一起>为例子.评论最底端有个查看更多评论猜测过去应该是 Ajax ...
- openssl的用法
Openssl详细用法: OpenSSL 是一个开源项目,其组成主要包括一下三个组件: openssl:多用途的命令行工具 libcrypto:加密算法库 libssl:加密模块应用库,实现了ssl及 ...