如何配置 Eclipse 构建路径以使用 Maven 依赖项?
I would like to take advantage of the features that Maven provides for managing dependencies in a project. My brief understanding of how Maven works is that it will aquire the JARs needed and then build the project with these libraries.
Currently I have a simple POM file set up as a test:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.jamesgoodwin.test</groupId>
<artifactId>com.jamesgoodwin.test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
</build>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.0.0.RELEASE</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
To manage dependencies, I usually add the project or JAR to the build path and then i'll be able to build my project..
But when using M2Eclipse the dependencies are not added automatically to the build path. Is there any configuration to let Eclipse know that the Maven is managing the dependencies?
解决方案If you right-click on your project, there should be an option under "maven" to "enable dependency management". That's it.
相关文章