• Maven常见异常及解决方法


    异常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:mavenweb_nanchang argetsurefire-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~1ADMINI~1LOCALS~1Tempcargoinstallsapache-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 SettingsAdministratorLocal SettingsTempcargoinstalls”下。

    异常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是在srcmainwebapp。如果在此目录下找不到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>

    异常5

    Eclipse中Maven工程缺少Maven Dependencies

    解决方法:

    产生这种现象的原因可能是工程对应的开发环境改变,本地Maven仓库地址和原来的不一致。其根本原因是Maven project的Maven选项未开启或启动无效。

    为了解决这个问题我们只需要重启Dependency Management就可以了。

    具体步骤:右击 Maven project --> Macven --> Enable Dependency Management

    说明:如果我们原有的工程中的Maven处于Enable状态下,但是同样没有Maven Dependencies类库,我们将原有的Maven project执行Disable Dependency Management,然后再重启下就行了。

    本文转自:http://blog.csdn.net/lch_cn/article/details/8225448

  • 相关阅读:
    【css系列】创建网页加载进度条
    【大数据系列】apache hive 官方文档翻译
    【大数据系列】问题汇总
    【大数据系列】hive修改默认的derby数据库
    【大数据系列】hive安装及启动
    【大数据系列】MapReduce详解
    【大数据系列】基于MapReduce的数据处理 SequenceFile序列化文件
    【大数据系列】windows下连接Linux环境开发
    【大数据系列】常用命令
    【大数据系列】hadoop脚本分析
  • 原文地址:https://www.cnblogs.com/nizuimeiabc1/p/4807775.html
Copyright © 2020-2023  润新知