开发者

JAR in project-specific local Maven repo, how to see library in Eclipse project?

I've been trying to add a custom .jar (ftp://ftp.ncbi.nlm.nih.gov/pub/eutils/soap/v2.0/java/axis2_1.5.2_jdk_6.0.12/eutils_axis2.jar) to a project that doesn't have a central corporate maven repository and that instead will have the custom JARs checked into SCM in the project directory tree. I was following this post to make it happen: Maven: add a dependency to a jar by relative path (awesome post btw).

What I did was:

  1. Add local repository to 开发者_高级运维pom.xml
  2. install the file into the local repository
  3. Add dependency to pom.xml

Based on what I see in m2eclipse, the library has been successfully recognized by Maven and added to the dependency list (or it'd be called ? : ? or something similar)

The problem is that Eclipse still doesn't see the referenced lib, so this still fails:

import gov.nih.nlm.ncbi.www.soap.eutils.*;

Pardon my maven newbiness, but what are changes / next steps I need to make to get to:

  1. Have Eclipse see the library so that autocomplete works (and the import can be resolved)
  2. Be able to compile the project
  3. Be able to execute the jar produced by mvn package?

Thanks!


If you see the JAR under "Maven Dependencies" in your project, Eclipse should be able to see and use it. If it's not there, then m2eclipse wasn't able to resolve the dependency properly.

If it is missing, m2eclipse was unable to download the dependency from your local repository for some reason. Check the Maven 2 Console for errors and the Problem View.

Lastly, the JAR itself might be corrupt. Maven doesn't check for that, it simply adds the file to the classpath. If Eclipse can't open the JAR, you can also get the errors you mentioned.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜