Maven 使用笔记

  • maven dependency中scope=compile 和 provided区别:http://blog.51cto.com/supercharles888/981316
  • maven profile切换正式环境和测试环境 https://www.cnblogs.com/nfcm/p/7550772.html
  • maven打包 mvn clean package -P dev -Dmaven.test.skip=true
  • maven修改war包名
<build>
    <finalName>自定义war包名</finalName>
</build>
  • 修改maven默认编译JDK
<profile> 
  <id>jdk-1.8</id> 
  <activation> 
    <activeByDefault>true</activeByDefault> 
    <jdk>1.8</jdk> 
  </activation> 
  <properties> 
    <maven.compiler.source>1.8</maven.compiler.source> 
    <maven.compiler.target>1.8</maven.compiler.target> 
    <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion> 
  </properties> 
</profile>
  • Maven 阿里云镜像配置 settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<mirrors>
<!-- 阿里云仓库 -->
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>

<!-- 中央仓库1 -->
<mirror>
<id>repo1</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo1.maven.org/maven2/</url>
</mirror>

<!-- 中央仓库2 -->
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
</mirrors> 
</settings>
  • 配置私有仓库地址
  <profiles>
        <profile>
            <id>jdk-1.8</id>
            <activation>
                <jdk>1.8</jdk>
            </activation>
            <repositories>
                <repository>
                    <id>mvnrepository</id>
                    <name>Repository for JDK 1.8 builds</name>
                    <url>http://maven.xxx.com/nexus/content/groups/public/</url>
                    <layout>default</layout>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>always</updatePolicy>
                    </snapshots>
                </repository>
            </repositories>
        </profile>
    </profiles>

 

posted @ 2018-09-25 17:32  bookc  阅读(255)  评论(0编辑  收藏  举报