我在學習Maven環境中的Spring。我正在使用netbeans。在maven項目中導入org.springframework
的pom.xml
<dependencies>
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.davidsalter.cookbook</groupId>
<artifactId>springMavenTest</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.3.4.RELEASE</version>
</dependency>
</dependencies>
</project>
而且spring.context-4.3.4.RELEASE.jar下出現依賴。在Java依賴關係我只有JDK1.8。
當我必須在使用@Configuration和@Bean註釋的java類中配置我的bean時,我無法導入org.springframework。
我使用的是NetBeans,如果我從項目窗口右鍵單擊我的Maven項目,我沒有任何「Maven」選項。如果我選擇「與依賴關係構建」,我對此[鏈接]有一個錯誤(http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException)。我在帖子中添加了完整的pom – Maver