0
votes

When I imported Existing Maven Projects downloaded from open-source-website(eg. Apache, Github) into Eclipse, Several errors happened :( . Note that, all maven projects can correctly compile and test under the Eclipse.

  • Firstly, after importing maven projects into Eclipse, there will be a red X on the project icon, but there are no error in projects. I found there exist parent node in pom.xml file. I deleted the node then the error is gone, I want to know why since there is no module in maven project. the following code is the node I deleted before.
<parent>
    <groupId> org.apache.commons </groupId>
    <artifactId> commons-parent </artifactId>
    <version> 38</version>
  </parent>
  • Next, In the project jaxen, this project's structure is odd. In the project I just found src/java/main and src/java/test rather than src/main/java and src/test/java, is there any other configuration I should do even though it can correctly run under Eclipse?

  • What's more, I also found errors in code sources of jaxen, See this picture, the error information is partial given as follows, look for your help and thanks in advance :)

Failure to transfer xerces:xmlParserAPIs:jar:2.6.2 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact xerces:xmlParserAPIs:jar:2.6.2 from/to central (https://repo.maven.apache.org/maven2): The operation was cancelled.

org.eclipse.aether.transfer.ArtifactTransferException: Failure to transfer xerces:xmlParserAPIs:jar:2.6.2 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact xerces:xmlParserAPIs:jar:2.6.2 from/to central (https://repo.maven.apache.org/maven2): The operation was cancelled.
    at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:238)
    at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:206)
2
Can you run "mvn clean install" on the individual projects from the command line?Thorbjørn Ravn Andersen
Surely, I can run "mvn clean install" or other standard maven commands on all projects but eclipse will report error on jaxen project when I import it.Yongfeng

2 Answers

0
votes

The following error org.eclipse.aether.transfer.ArtifactTransferException: Failure to transfer xerces:xmlParserAPIs:jar:2.6.2 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact xerces:xmlParserAPIs:jar:2.6.2 from/to central (https://repo.maven.apache.org/maven2): The operation was cancelled will be fixed by Step 2.

Try this, if 1 does not work try 2:

1) First update the project, Alt-F5

2) Then go to your repo and blow away the directory for that dependency which should be in the directory HOME_DIRECTORY/.m2/repo/xerces/xmlParserAPIs/2.6.2 Then do an Alt-F5 again.

3) If this fails try a mvn clean install -U from the command line.

0
votes

Although I have accepted Essex Boy's answer, I'd like to say that another link Error on Importing existing Maven project to eclipse is similar to my third question. Maybe cleaning up the corresponding jars from local maven repository is a good solution.

As for my first question, http://maven.apache.org/guides/introduction/introduction-to-the-pom.html tells us the preliminary usage of parent. But I still don't know why.

Uh... And second questions needs my another efforts to work it out. Perhaps that developers need these strange and odd project structure for another target, And I also will appreciate it if someone can tell me the answer, Thanks all the same > <