Maven项目创建与配置(二)

项目配置

1:添加Source Folder

右击项目》NEW》Source Folder

maven规定必须创建一下几个Source Folder

src/main/resources

src/main/java

src/test/resources

src/test/java

 

2:添加必要的依赖包

2.1:添加以下依赖包httpclient、httpcore、Fastjson、Testng

2.2:在Pom文件中配置依赖包

<dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.7</version>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.10</version>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.10</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.6</version>
</dependency>

<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.62</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>

 

 

 

2. 3:添加完成后可以看到Maven Dependencies出现了相关的依赖包

3:配置Build Path

4:设置四个文件的输出路径

src/main/resources  对应  target/classes

src/main/java  对应  target/classes

src/test/resources  对应  target/test-classes

src/test/java  对应  target/test-classes

 

posted @ 2020-09-01 09:31  指尖上的那本书  阅读(177)  评论(0编辑  收藏  举报