开发者

Maven 2 dependency problem

开发者 https://www.devze.com 2023-01-30 22:39 出处:网络
I\'m merging two projects into one(mergin project1 into project2). Now I\'m going to copy all dependencies from project1 pom into project2 pom, like :

I'm merging two projects into one(mergin project1 into project2). Now I'm going to copy all dependencies from project1 pom into project2 pom, like :

        <dependency>
            <groupId>commons-configuration</groupId>
            <artif开发者_开发百科actId>commons-configuration</artifactId>
            <version>1.6</version>
        </dependency>

And some others. The build is successful the thing in eclipse annoys me so much like when hovering over import org.apache.commons.configuration.ConfigurationException:

The import org.apache.commons.configuration cannot be resolved

But the build still succeds, what can I do to get rid of these?


If you use m2eclipse, you need to click Maven -> Update Dependencies.

Otherwise I guess you need to regenerate the Eclipse project with mvn eclipse:eclipse.


Try doing 'mvn eclipse:clean eclipse:eclipse'. That will force maven to delete all of the old eclipse configurations for your project and rebuild them from scratch.


Maybe try to edit POM by inserting whitespace and saving it. It should trigger rebuilding of the project. There is also a "Refresh Dependencies" option in m2eclipse plugin. I had similiar problems when I used Eclipse integrated with Maven and the 1st technique usually helped.


Make sure a build is done successfully and ensure that on your Package Explorer the org.apache.commons jar is found under the Maven Dependencies section (given you have m2eclipse plugin installed in your eclipse)


What version of Eclipse, mvn and m2eclipse? Might want to double-check those.

You shouldn't need to do mvn eclipse:eclipse anymore - that's obsolete. You can try deleting your Eclipse project files and reopening the project (settings, project, classpath).

0

精彩评论

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

关注公众号