maven项目配置pom.xml

上一篇 / 下一篇  2017-09-13 16:46:20 / 个人分类:maven

需要配置maven需要的plugin,以及dependency:

下面是最简单的pom.xml配置:

<projectxmlns="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.lenovo</groupId>


<artifactId>companion</artifactId>


<version>0.0.1-SNAPSHOT</version>






<dependencies>


<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-server-standalone -->


<dependency>


<groupId>org.seleniumhq.selenium</groupId>


<artifactId>selenium-server-standalone</artifactId>


<version>2.46.0</version>


</dependency>






<dependency>


<groupId>junit</groupId>


<artifactId>junit</artifactId>


<version>4.12</version>


<scope>test</scope>


</dependency>




<dependency>


<groupId>io.appium</groupId>


<artifactId>java-client</artifactId>


<version>2.2.0</version>


</dependency>




<dependency>


<groupId>dom4j</groupId>


<artifactId>dom4j</artifactId>


<version>1.6.1</version>


</dependency>




<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->


<dependency>


<groupId>org.apache.logging.log4j</groupId>


<artifactId>log4j-core</artifactId>


<version>2.8.2</version>


</dependency>




<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api -->


<dependency>


<groupId>org.apache.logging.log4j</groupId>


<artifactId>log4j-api</artifactId>


<version>2.8.2</version>


</dependency>


<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->


<dependency>


<groupId>org.apache.maven.plugins</groupId>


<artifactId>maven-compiler-plugin</artifactId>


<version>3.6.1</version>


</dependency>





</dependencies>





<build>

<!-- 这里默认的defaultgoal可以不写,使用默认的值,默认就是compile-->

<defaultGoal>compile</defaultGoal>


<plugins>


<plugin>


<!-- 用于编译阶段的插件 -->


<groupId>org.apache.maven.plugins</groupId>


<artifactId>maven-compiler-plugin</artifactId>


<version>3.6.1</version>


<executions>


<execution>


<id>default-compile</id>


<phase>compile</phase>


<goals>


<goal>compile</goal>


</goals>


</execution>


</executions>





<configuration>


<source>1.8</source>


<target>1.8</target>


<encoding>UTF-8</encoding>


</configuration>


</plugin>




<plugin>


<!-- 用于mavensource阶段的插件 -->


<groupId>org.apache.maven.plugins</groupId>


<artifactId>maven-source-plugin</artifactId>


<version>3.0.1</version>


</plugin>


<plugin>


<groupId>org.apache.maven.plugins</groupId>


<artifactId>maven-surefire-plugin</artifactId>


<version>2.20</version>


<configuration>


<source>1.8</source>


<target>1.8</target>







</configuration>


</plugin>


</plugins>


</build>


</project>



注意:这里有个dependency在maven中央仓库中没有,无法从中央仓库中下载,这个时候需要我们手动添加本地的jar包,如selenium-server-standalone.jar,这时候我们就要在cmd窗口中自己将本地路径的jar文件安装到本地仓库中:需要使用命令进行安装:


mvn install:install-file -Dfile=D:\jar\selenium-server-standalone.jar -DgroupId=org.seleniumhq.selenium -artifactId=selenium-server-standalone -Dversion=2.46.0 -Dpackaging=jar








TAG:

 

评分:0

我来说两句

Open Toolbar