pom.xml中的項目配置
1 <!--當前項目坐標--> 2 <groupId>cn.itcast</groupId> 3 <artifactId>maven_java_1</artifactId> 4 <version>1.0-SNAPSHOT</version> 5 <!--打包方式jar--> 6 <packaging>jar</packaging>
導入jar包
1 <!--導入單元測試jar包--> 2 <dependencies> 3 <dependency> 4 <groupId>junit</groupId> 5 <artifactId>junit</artifactId> 6 <version>4.9</version> 7 <scope>test</scope> 8 </dependency> 9 </dependencies>
導入jar包需要有坐標,如果本地倉庫中有,則在輸入時會有提示。
如果沒有,可以在瀏覽器輸入maven repository
然后選擇一個版本的jar包,把配置信息粘貼到pom.xml的<dependencies>標簽中