开发者

maven adds dependency but eclipse does not see it

开发者 https://www.devze.com 2023-03-22 12:44 出处:网络
I\'ve created a new project in maven like this: mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

I've created a new project in maven like this:

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

After that I use: mvn eclipse:eclipse

The problem is that when I add the project to my IDE, eclipse indicates errors. When I run it I get classNotFound for JUnit. In project properties I see that junit is added to build path

In project properties I see: M2_REPO/junit/junit/3.8.1/juni开发者_如何学Ct-3.8.1.jar

But I cant use for example: import junit.framework.Test;

Why is that? To be honest, I have some major problems with dependency in maven and eclipse. Maven adds them correctly but eclipse doesn't see it correctly. It's not only the junit. What should I check/set?

Should I install some plugin to eclipse for maven support ?

EDIT

I thought again about everything. Of course the problem was small. M2_REPO was not recognize by Eclipse. I've added this variable and set it in od maven directory. It worked like a charm.


You can use the m2eclipse plugin for eclipse

http://m2eclipse.sonatype.org/installing-m2eclipse.html

I don't know if having the plugin would solve your problem, I used to do the command line before I started using m2elcipse, I never had the issue that you described

what version of eclipse are you using?

0

精彩评论

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