maven使用笔记

1、maven引用第三方jar

①,下载jar包,使用以下命令将下载的包安装至本地仓库中:

mvn install:install-file -DgroupId=net.sf.ehcache -DartifactId=ehcache -Dversion=2.9.0 -Dpackaging=jar -Dfile=D:/repository/ehcache-2.9.0.jar -DgeneratePom=true

②,下载jar包,直接引用:

        <dependency>
            <groupId>net.sf.ehcache</groupId>
            <artifactId>ehcache</artifactId>
            <version>2.9.0</version>
            <scope>system</scope>
            <systemPath>D:/repository/ehcache-2.9.0.jar</systemPath>
        </dependency>

以上方式都只能本地使用,如果多人开发的环境,还是需要上传到公共的仓库中

2、常用命令

①,跳过单元测试:

mvn clean install -Dmaven.test.skip=true

或者在pom.xml加入:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>

或者:

<properties>
    <project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
    <maven.test.skip>true</maven.test.skip>
</properties>


你可能感兴趣的:(maven使用笔记)