Maven common exceptions and solutions

Exception 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]

Solution:

This is because the configured url is wrong or the private server is not configured properly, resulting in an error when downloading the component. If there is no jar package that needs to be downloaded in the private server, you can not configure the private server, that is, you can delete all the things in the profiles of setting.xml .

 

Exception 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.

Solution:

This is because the test code encounters an error and it stops compiling. Just add the following configuration to <project> in pom.xml , so that test errors do not affect the compilation of the project.

<build>

    <plugins>

        <plugin>

            <groupId>org.apache.maven.plugins</groupId>

            <artifactId>maven-surefire-plugin</artifactId>

            <configuration>

                <testFailureIgnore>true</testFailureIgnore>

            </configuration>

        </plugin>

    </plugins>

</build>

 

Exception 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 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:









[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

Solution:

Download "apache-tomcat-6.0.29.zip" by yourself , and copy the downloaded file to the specified folder "C:\Documents and Settings\Administrator\Local Settings\Temp\cargo\installs" .

 

Exception 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:

Solution:

The default webroot of maven 's web project is src\main\webapp . The above exception is thrown if web.xml is not found in this directory . Solution Add the following configuration to pom.xml . Change the red font to the root directory of your website.

<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>

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325445654&siteId=291194637