maven优化-repositories,dependencyManagement,pluginManagement
http://www.oschina.net/question/158170_29027
1. <repositories>
<?xml version="1.0" encoding="UTF-8"?>
<project......
.......
<!-- 設定除中央倉庫(repo1.maven.org/maven2/)外的其他倉庫,按設定順序進行查找. -->
<repositories>
?? <repository>
??? <id>nexus</id>
??? <name>Team Nexus Repository</name>
??? <url>http://localhost:8081/nexus/content/groups/public</url>
?? </repository>
?? <repository>
??? <id>offical</id>
??? <name>Maven Official Repository</name>
??? <url>http://repo1.maven.org/maven2</url>
??? <snapshots>
???? <enabled>false</enabled>
??? </snapshots>
?? </repository>
......
</repositories>
可以在單個pom 文件中設置當前工程使用的repository.這樣的設置
2. <dependencyManagement> 預定義依賴項的version,scope與exclusions,子項目中只需定義groupId 和 artifactId 即可.實現的目的是:可以把一些特殊的依賴在父項目中統一定義好,子項目中只需要知道用哪些就行了,而不用關心版本號,排除哪些依賴、使用范圍是什么。
<dependencyManagement>
?? <dependencies>
......
?? </dependencies>
</dependencyManagement>
3.????<pluginManagement> 把插件使用的版本等信息在父工程中定義好,子工程中使用即可。
<!-- 插件配置 -->
<build>
?? <pluginManagement>
??? <plugins>
......
?
總結
以上是生活随笔為你收集整理的maven优化-repositories,dependencyManagement,pluginManagement的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Maven用仓库外的jar进行编译
- 下一篇: 使用Memory Analyzer to