Pox.xml File Error and project compilation errors in Maven project

Source: Internet
Author: User
Tags xmlns

I used eclipse to develop the MAVEN project, originally good, but later inexplicably pom.xml file error, and then execute the install command when the compilation does not pass the error. I groped the whole day in agony and finally solved the problem. Although the problem has been solved, but I do not know the crux of the problem, do not know why, I do not know what the last step is the effective means to solve the problem. Here's a brief description of the approach I'm using. Very confusing, no reason. Anyway it was somehow bad, and then the random tinkering, and somehow better.

First, the first line in the Pom.xml file is an error.

<project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
xsi:schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" >

This line was marked red, there was a baffling multiple annotations found at the This line:missing artifact Org.mortbay.jetty:jet a long string of errors. (As with this error: http://www.myexception.cn/web/1501238.html, you can try this workaround first.) )



The problem behind Pom.xml is resolved, but when compiling (Execute command: mvn install), the error

    Failed to execute goal in Project Ui:could not resolve dependencies for project <<package>>:ui:war:1 .0:failed to collect dependencies for [javax.servlet:servlet-api:jar:2.5 (provided), Org.springframework:spring-core : Jar:3.0.5.release (Compile), org.springframework:spring-web:jar:3.0.5.release (Compile), cglib:cglib:jar:2.2 (c Ompile), org.springframework:spring-aop:jar:3.0.5.release (Compile), org.springframework:spring-webmvc:jar:3.0.5. RELEASE (Compile), org.springframework:spring-context:jar:3.0.5.release (compile), Org.freemarker:freemarker:jar : 2.3.18 (Compile), gr.imu.ntua.tweetinspire:services:jar:1.0 (Compile), Org.cloudfoundry.samples: tomcat7-standalone:tar.gz:7.0.29 (Compile), org.slf4j:slf4j-api:jar:1.6.1 (compile), Org.slf4j:slf4j-log4j12:jar : 1.6.1 (Compile), org.slf4j:jcl-over-slf4j:jar:1.6.1 (Compile), commons-logging:commons-logging:jar:1.1.1 (compile) , junit:junit:jar:4.8.1 (test), ORG.SPRINGFRAMEWORK:SPRIng-test:jar:3.0.5.release (test), org.dbunit:dbunit:jar:2.4.8 (test)]: Failed to read artifact descriptor for Org.cloudfoundry.samples:tomcat7-standalone:tar.gz:7.0.29:could not transfer artifact Org.cloudfoundry.samples: tomcat7-standalone:pom:7.0.29 from/to jets3t (http://www.jets3t.org/maven2): Access denied to:http://www.jets3t.org/
 Maven2/org/cloudfoundry/samples/tomcat7-standalone/7.0.29/tomcat7-standalone-7.0.29.pom, ReasonPhrase:Forbidden



Workaround One:

Later, a section of the pom.xml that relies on JDK is commented out,

<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.5.0</version>
<scope>system</scope>
<systemPath>
D:\java\jdk\lib\tools.jar
</systemPath>
</dependency>

Then clear the Eclipse project (click Project in the Eclipse Editor and click Clean), and then cancel the comment from the above code.



Workaround Two:

If the above method does not resolve the problem, you can also try to turn off the MAVEN project to automatically download the Update warehouse option when the project starts. Here's how it works:

Click on the Window menu in Eclipse, select Preferences, click Maven on the left, and then remove the checkmark in front of the download repository index updates on startup option, Then clean up the Eclipse Project (Project-->clean).



Workaround Three:

If the above workaround has not resolved the problem, you can check the C:\Users\Y480\.m2 (Y480 is my Computer user name, the specific directory to see your own project directory) under the directory of whether there is a settring.xml file. If there is, delete it. (No problem.) If you're worried, just cuff it somewhere else and back it up. ) and then clean up the Eclipse Project (Project-->clean).


I through the above method repeated over the half-day, finally solve the problem, adjust the environment is too tired. The above statement is confusing because it was a few weeks ago and now it's written. I think it is necessary to write a little something that may be useful to some people when I think of the pain of isolating and helpless when I couldn't find a solution.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.