17

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

prayagupa
  • 30,204
  • 14
  • 155
  • 192
nacho
  • 171
  • 1
  • 1
  • 3
  • Are you sitting behind a proxy and haven't configured it in the Maven settings.xml, so Maven can't find the central repository? That libs are all in the central, so the only thing i can think of is a problem with your internet connection. – dunni May 16 '11 at 19:40

4 Answers4

48

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

enter image description here

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

S.K.
  • 3,597
  • 2
  • 16
  • 31
dharam
  • 7,882
  • 15
  • 65
  • 93
  • Followed both steps but it did not work , For step 3 , can you please elaborate where can I find org/apache folder ? – user3251882 Aug 14 '19 at 11:58
  • 1
    Force update worked for me. I created the maven projects and got this error in pom.xml. As per @dharam force update Snapshot and it worked. It also generated the correct project structure after force update. – Jaswinder Singh May 09 '20 at 14:27
0

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.

matt forsythe
  • 3,863
  • 1
  • 19
  • 29
0

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

Gerd
  • 2,265
  • 1
  • 27
  • 46
0

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

John Kane
  • 4,383
  • 1
  • 24
  • 42
  • I have "prj1/target/classes" there :( So that´s not the problem. Any other idea? – nacho May 16 '11 at 19:22
  • to bad that would have been simple. Just a side question, you do have maven set up correctly? and eclipse knows where your local repository is? – John Kane May 16 '11 at 19:43
  • if you go to the build path under your project properties in the libraries tab, are the libs from your pom there? – John Kane May 16 '11 at 19:45
  • Just one more question, when you created the project, did you create it as a maven project? or did you enable maven support? – John Kane May 16 '11 at 19:46
  • "you do have maven set up correctly?" I think yes. "and eclipse knows where your local repository is?" This, I am sure that yes is the answer. – nacho May 16 '11 at 19:52
  • did you create the project as a maven project or did you enable dependency management? – John Kane May 16 '11 at 19:56
  • "if you go to the build path under your project properties in the libraries tab, are the libs from your pom there?" Yeap "Just one more question, when you created the project, did you create it as a maven project? or did you enable maven support?" I unzipped the project (someone was working before with the same project), inside the unzipped folder were the 5 subprojects, each one with it's own pom.xml, and then in eclipse I did "File -> Import -> Existing Maven Projects" – nacho May 16 '11 at 19:58
  • nice, just trying to eliminate the simpler solutions. Do the poms reference each other? it could be that you have to install the poms into your local repository. – John Kane May 16 '11 at 20:12
  • when you said you imported five sub projects, were these imported into the their own separate projects? – John Kane May 16 '11 at 20:14
  • "Do the poms reference each other?" yes | "were these imported into the their own separate projects?" yes, each sub project is a project in my workspace after the import. – nacho May 16 '11 at 20:41
  • prj3 is parent of prj1, prj2, prj4 and prj5. And I tried to do "Run as -> MVN Install" over prj3. But it failed. I had this error: – nacho May 16 '11 at 20:53
  • [ERROR] Failed to execute goal org.apache.axis2:axis2-wsdl2code-maven-plugin:1.3:wsdl2code (default) on project prj4: Error parsing WSDL: WSDLException (at /wsdl:definitions/wsdl:types/xsd:schema): faultCode=OTHER_ERROR: An error occurred trying to resolve schema referenced at 'http://mysite.com...Exception.xsd', relative to 'file:/Users/nacho/Work/workspace/prj3/prj4/src/main/axis2/'.: java.net.UnknownHostException: mysite.com: Unknown host mysite.com -> [Help 1] – nacho May 16 '11 at 20:56
  • Are you sitting behind a proxy and haven't configured it in the Maven settings.xml, so Maven can't find the central repository? That libs are all in the central, so the only thing i can think of is a problem with your internet connection. – dunni May 17 '11 at 09:18
  • that could be it. It looks like it is looking at yoursite.com and couldn't find it. – John Kane May 17 '11 at 12:21
  • Now I'm having this trouble: Project build error: Unresolveable build extension: Plugin org.apache.axis2:axis2-wsdl2code-maven-plugin:1.3 or one of its dependencies could not be resolved: Failed to collect dependencies for org.apache.axis2:axis2-wsdl2code-maven-plugin:jar:1.3 () – nacho May 18 '11 at 20:11
  • this may help: http://axis.apache.org/axis2/java/core/tools/maven-plugins/maven-wsdl2code-plugin.html – John Kane May 18 '11 at 20:44