开发者

Eclipse build path with other projects

开发者 https://www.devze.com 2023-03-30 18:27 出处:网络
I\'ve got several projects in Eclipse (all are Maven projects) and one main project (also Maven project) which depends on the rest. I tried add this dependency by setting java build path (right click

I've got several projects in Eclipse (all are Maven projects) and one main project (also Maven project) which depends on the rest. I tried add this dependency by setting java build path (right click on project -> preferences -> java build path -> (tab) projects -> add). But there is a problem while executing maven install goal - this is compilation error: ... (class) ... "cannot be resolved" ... - this is definitely looks like maven does't see my resources from other projects. Eclipse is only warning me something like this: "Classpath entry /my-subproject1 will not be exported or published. Runtime ClassNotFoundExceptions may result." Th开发者_开发百科ese warnings referenced to each subproject and occurs in main project. There is no error messages from Eclipse. In my main project, where I'm importing classes from subprojects, I can right-click on one of the import and choose "Open declaration" and there is valid reference to class from one of my subproject - so it looks like Eclipse sees my dependencies (there is no eclipse errors while building workspace - only these warnings mentioned above) from other projects, but maven doesn't see them while compilation.

Have you got any ideas how can I fix this?

Thanks for help.


You have to declare your dependencies in the pom.xml for Maven. Maven doesn't recognize any Eclipse specific configurations (like Build Path etc.): Maven Tutorial

If you use the m2eclipse plugin, it will configure your Eclipse build path according to your pom.xml configuration


Isn't this maven problem?

Maven needs jar file made from other project inside maven repository.

I don't know much about maven eclipse plugin but so far, in my observation, it seems like it works this way.

So that this case need to build other project so that create it's jar file.

But this takes so much time.

0

精彩评论

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

关注公众号