开发者

Eclipse | Maven : Multiple annotations found at this line

I'm trying to import a maven project into Eclipse.

I'm using Helios. I've downloaded m2eclipse. I've imported the project.

But I'am having so much troubles to compile the project.

The full project contains 5 Eclipse projects, ie: prj1, prj2, prj3, prj4 and prj5

If I look the (Eclipse) marker at prj1/pom.xml I have this开发者_Go百科 troubles:

Multiple annotations found at this line:
    - Missing artifact log4j:log4j:jar:1.2.15:compile
    - Missing artifact org.apache.xmlbeans:xmlbeans-xpath:jar:2.4.0:compile
    - Missing artifact org.apache.ws.commons.axiom:axiom-dom:jar:1.2.5:compile
    - Missing artifact org.apache.httpcomponents:httpcore:jar:4.0-alpha5:compile

.... and so many more ...

If I understood how maven works those dependecies must be downloaded my maven, am I wrong?

Why is it that those dependencies are not being downloaded? Should I download one by one, by hand?


It is not a unique issue, happens every now and then (sometimes due to a slow connection and sometimes due to proxy servers not allowing to download)

You can get rid of this by either of the following ways:

1) Force Update: Right Click on the Project in Eclipse -> Maven -> Update Project On this screen select the check box Force Update for Snapshots/Releases

Eclipse | Maven : Multiple annotations found at this line

2) Clearing Maven Cache: If you are still facing a problem, go to the local repository on your system, which might be present at C:\Users\myusername\.m2\repository and delete the .cache folder and then follow step 1.

If you're still facing issues after this, manually go to the org/apache folder and delete everything and then follow step 1. (This will definitely solve the issue.)


Make sure your build path is going to /target/classes

to check:

right click on your project and go to properties
  -> choose java build path 
    -> then go to the source tab 

the default output folder is on the bottom


With Eclipse/Maven projects, I've always had more luck building from the command line (mvn clean package) first in order to download all of the dependencies. Once that completes without errors, then I import the project into Eclipse.


It can be a mistake in pom repository / dependency definition

i.e. I want include in pom groupId:org.clapper artifactId:javautil

The home page of clapper say use:

http://software.clapper.org/javautil

 <repositories>
   <repository>
     <releases>
       <enabled>true</enabled>
       <updatePolicy>always</updatePolicy>
       <checksumPolicy>warn</checksumPolicy>
     </releases>
     <id>clapper-org-maven-repo</id>
     <name>org.clapper Maven Repo</name>
     <url>http://maven.clapper.org/</url>
     <layout>default</layout>
   </repository>
   ...
 </repositories>

and

 <dependency>
   <groupId>org.clapper</groupId>
   <artifactId>javautil</artifactId>
   <version>3.1.2</version>
 </dependency>

It don't work! I got "Multiple annotations found at this line"!!!

If I use dependency from

https://github.com/shilad/wikibrain/blob/master/wikibrain-utils/pom.xml

 <repository>
    <releases>
       <enabled>true</enabled>
       <updatePolicy>always</updatePolicy>
       <checksumPolicy>warn</checksumPolicy>
    </releases>
    <id>clapper-org-maven-repo</id>
    <name>org.clapper Maven Repo</name>
    <url>http://maven.clapper.org/</url>
    <layout>default</layout>
 </repository>

+

 <dependency>
    <groupId>org.clapper</groupId>
    <artifactId>javautil</artifactId>
    <version>3.1.1</version>
 </dependency>

It work fine!!!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜