maven项目常用配置说明

2019-05-30  本文已影响0人  走码人

记录在学习maven管理项目中的点点滴滴

1、指定项目编译的JDK版本

在pom文件中增加下面的配置,即可指定项目的JDK版本信息

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>                      
                <!-- <version>3.7.0</version> -->
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>utf-8</encoding>
                </configuration>
            </plugin>
        </plugins>
    </build>

2、指定项目使用maven的中央仓库信息

    <repositories>
        <repository>
            <!-- Maven 自带的中央仓库使用的Id为central 如果其他的仓库声明也是用该Id 就会覆盖中央仓库的配置 -->
            <id>nexus-public</id>
            <name>Nexus Public Repository</name>
            <url>http://10.1.0.12:8081/repository/maven-public/</url>
            <layout>default</layout>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
上一篇 下一篇

猜你喜欢

热点阅读