运行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 boot AOP 实现Redis 存储
package com.carloan.common.web.annotation; import java.lang.annotation.*; /** * 自定义redis缓存注解.只要在serv ...
- MongoDB:原来我如此简单
为什么要使用 MongoDB 张三大学毕业设计题目是<XXX博客论坛>,他在存储用户评论的时候遇到了一个问题:这些评论数据量非常大,但是价值不是很大,如果存储在 MySQL 数据库中就会浪 ...
- docker(6)镜像的使用
前言 Docker的三大核心概念:镜像.容器.仓库.初学者对镜像和容器往往分不清楚,学过面向对象的应该知道类和实例,这跟面向对象里面的概念很相似 我们可以把镜像看作类,把容器看作类实例化后的对象. d ...
- Maven三种打包方式jar war pom
1.pom工程 用在父级工程或聚合工程中.用来做jar包的版本控制.必须指明这个聚合工程的打包方式为pom 2.war工程 将会打包成war,发布在服务器上的工程.如网站或服务.在SpringBoot ...
- Java一些概念
1.Java先编译后解释 同一个.class文件在不同的虚拟机会得到不同的机器指令(Windows和Linux的机器指令不同),但是最终执行的结果却是相同的. 2.JDK包含JRE,JRE包含JVM, ...
- Codeforces Round #625 (Div. 2, based on Technocup 2020 Final Round) A. Contest for Robots(数学)
题意: n 道题,2 个答题者,已知二者的做题情况,你是受贿裁判,可以给每题指定分值(≥1),求甲乙分数(甲>乙)相差最小时最大分值的最小值. 思路: 统计只有甲或乙做出的题目数. 加一取下整判 ...
- 【noi 2.6_9283】&【poj 3088】Push Botton Lock(DP--排列组合 Stirling数)
题意:N个编号为1~N的数,选任意个数分入任意个盒子内(盒子互不相同)的不同排列组合数. 解法:综合排列组合 Stirling(斯特林)数的知识进行DP.C[i][j]表示组合,从i个数中选j个数的方 ...
- R - 0 or 1(最短路)
Given a n*n matrix C ij (1<=i,j<=n),We want to find a n*n matrix X ij (1<=i,j<=n),which ...
- 国产网络测试仪MiniSMB - 如何3秒内创建出16,000条IP递增流
国产网络测试仪MiniSMB(www.minismb.com)是复刻smartbits的IP网络性能测试工具,是一款专门用于测试智能路由器,网络交换机的性能和稳定性的软硬件相结合的工具.可以通过此以太 ...
- spark 一、编程指南
总览 第一.每个spark 应用都有一个驱动程序去运行着主函数和再每个节点上的并行操作. spark提供了一个RDD(弹性分布式数据集)的数据集合,可以通过不同的节点并行操作运算,可以通过hdfs文件 ...