<?xml version="1.0" encoding="UTF-8"?><settingsxmlns="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"><!-- 本地倉庫地址--><localRepository>/root/.m2/repository</localRepository><pluginGroups></pluginGroups><proxies></proxies><servers><!-- 配置服務,其實只要一個就可以,但是爲了權限區分,所以使用多個--><server><id>nexus</id><username>project-developer</username><password>developer123</password></server><server><id>nexus-releases</id><username>project-developer</username><password>developer123</password></server><server><id>nexus-snapshots</id><username>project-developer</username><password>developer123</password></server></servers><mirrors><!-- 定義鏡像地址 --><!-- 私有鏡像庫 id 要和 servers 中的 server 中的 id 一致, 纔會用對應的信息驗證權限--><!-- mirrorOf 直接用 * 就可以 --><mirror><id>nexus</id><name>myself maven</name><mirrorOf>*</mirrorOf><url>http://192.168.220.50:10000/repository/maven-public/</url></mirror><mirror><id>alimaven</id><name>aliyun maven</name><mirrorOf>central</mirrorOf><url>http://maven.aliyun.com/nexus/content/groups/public/</url></mirror><mirror><id>defmaven</id><name>maven repository</name><mirrorOf>central</mirrorOf><url>http://repo2.maven.org/maven2/</url></mirror></mirrors><profiles><!-- 如果該處定義的 profile 都在 activeProfiles 中激活的話, 會按這邊的順序後面的覆蓋前面的--><!-- override maven center releases and snapshots --><profile><id>central</id><repositories><repository><id>central</id><url>http://central</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository></repositories><pluginRepositories><pluginRepository><id>central</id><url>http://central</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository></pluginRepositories></profile><!-- 定義私庫 --><profile><id>nexus</id><repositories><repository><id>nexus</id><name>Nexus</name><url>http://192.168.220.50:10000/repository/maven-public/</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></repository></repositories><pluginRepositories><pluginRepository><id>nexus</id><name>Nexus</name><url>http://192.168.220.50:10000/repository/maven-public/</url><releases><enabled>true</enabled></releases><snapshots><enabled>true</enabled></snapshots></pluginRepository></pluginRepositories></profile></profiles><!-- active last profile which definition in profiles --><activeProfiles><activeProfile>central</activeProfile><activeProfile>nexus</activeProfile></activeProfiles></settings>
配置項目 pom.xml
<?xml version="1.0" encoding="UTF-8"?><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 https://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.2.2.RELEASE</version><relativePath/><!-- lookup parent from repository --></parent><groupId>cn.texous.test</groupId><artifactId>demo-gitlabci</artifactId><version>0.0.1-SNAPSHOT</version><name>demo-gitlabci</name><description>Demo project for Spring Boot</description><properties><java.version>1.8</java.version></properties><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><optional>true</optional></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope><exclusions><exclusion><groupId>org.junit.vintage</groupId><artifactId>junit-vintage-engine</artifactId></exclusion></exclusions></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build><distributionManagement><snapshotRepository><id>nexus-snapshots</id><url>http://192.168.220.50:10000/repository/maven-snapshots/</url></snapshotRepository><repository><id>nexus-releases</id><url>http://192.168.220.50:10000/repository/maven-releases/</url></repository></distributionManagement></project>