maven总是配置不成功,是啥原因?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了maven总是配置不成功,是啥原因?相关的知识,希望对你有一定的参考价值。

抓狂死了,这是什么情况?

参考技术A 遇到的问题和解决

错误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.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>

错误4:
严重: The web application [/web_nanchang] registered the JBDC driver
[org.hsqldb.jdbc.JDBCDriver] but failed to unregister it when the web
application was stopped. To prevent a memory leak, the JDBC Driver has
been forcibly unregistered.

2012-4-27 10:36:49 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc

严重: The web
application [/web_nanchang] registered the JBDC driver
[com.mysql.jdbc.Driver] but failed to unregister it when the web
application was stopped. To prevent a memory leak, the JDBC Driver has
been forcibly unregistered.

不知道怎样解决,导致运行不了。

错误5:

把java complier改成1.6或者disabled dependency manangent后在enable消失了。
参考技术B 直接在path里面配置好了,添加maven的bin目录。不用配置 mavne_home本回答被提问者采纳

以上是关于maven总是配置不成功,是啥原因?的主要内容,如果未能解决你的问题,请参考以下文章

第一次使用 将jmeter 做网站压力测试 我的http请求如下配置,但总是运行不成功。请教一下原因。

idea加入依赖包后不提示引入类是啥原因

第一天来公司拉取的代码pom内的parent依赖不上是啥原因?

邮件发送失败的原因是啥?为何总是发不出去呢?

maven mvn compile 报错是啥原因

centos下mysql总是无故停止,是啥原因?