maven的定义:项目生命周期的管理,基于plugin的开源工具。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 |
<executions> <!-- 配置插件在哪个阶段使用 --> <execution> <id>echodir</id> <goals> <goal>run</goal> </goals> <phase>verify</phase> <inherited> false </inherited> <configuration> <tasks> <echo>Build Dir: ${project.build.directory}</echo> </tasks> </configuration> </execution> </executions> |
<reporting> <plugins> <plugin> <outputDirectory>${basedir}/target/site</outputDirectory> <artifactId>maven-project-info-reports-plugin</artifactId> <reportSets> <reportSet></reportSet> </reportSets> </plugin> </plugins> </reporting>
多个report使用reportSets:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 |
<reporting> <plugins> <plugin> ... <reportSets> <reportSet> <id>sunlink</id> <reports> <report>javadoc</report> </reports> <inherited> true </inherited> <configuration> <links> <link>http: //java.sun.com/j2se/1.5.0/docs/api/</link> </links> </configuration> </reportSet> </reportSets> </plugin> </plugins> </reporting> |
1
2
3
4
5
6
7 |
<distributionManagement> <repository> <id>proficio-repository</id> <name>Proficio Repository</name> <url>file: //${basedir}/target/deploy</url> </repository> </distributionManagement> |
1
2
3
4
5
6
7
8
9
10
11
12
13
14 |
<profiles> <profile> <id>test</id> <activation>...</activation> <build>...</build> <modules>...</modules> <repositories>...</repositories> <pluginRepositories>...</pluginRepositories> <dependencies>...</dependencies> <reporting>...</reporting> <dependencyManagement>...</dependencyManagement> <distributionManagement>...</distributionManagement> </profile> </profiles> |
<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"> <localRepository/> <!-- 指定本地仓库位置 --> <interactiveMode/> <!-- 指定 maven 的运行模式是否为交互模式 --> <usePluginRegistry/> <!-- 目前少用,指定插件配置文件 --> <offline/> <!-- 指定是否为离线模式,在不需要网络交互的时候使用 --> <pluginGroups/> <!-- 指定插件所在的路径,maven 将通过该路径查找插件 --> <servers/> <!-- 指定服务器的用户名、密码等,用于上传,下载文件等 --> <mirrors/> <!-- 指定 maven 主仓库的镜像 --> <proxies/> <!-- 网络代理配置,用于有代理的网络 --> <profiles/> <!-- pom.xml 中的 profile 能够用于公共配置的部分 --> <activeProfiles/> </settings>
示例:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 |
<settings xmlns= "http://maven.apache.org/SETTINGS/1.0.0" xsi:schemaLocation= "http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" > ... <servers> <server> <!-- 设置发布 jar 包时的用户名及密码 --> <id>deploymentRepo</id> <username>deployment</username> <password>deployment123</password> </server> </servers> ... <mirrors> <mirror> <!-- 设置 maven 的远程仓库为 nexus --> <id>nexus</id> <mirrorOf>*</mirrorOf> <name>Local Repository</name> <url>http: //192.168.1.60:8081/nexus/content/groups/public</url> </mirror> </mirrors> ... <profiles> ... <profile> <!-- 设置 nexus 的路径等 --> <id>nexus</id> <repositories> <repository> <id>central</id> <name>local private
nexus</name> <url>http: //localhost:8081/nexus/content/groups/public</url> <releases><enabled> true </enabled></releases> <snapshots><enabled> true </enabled></snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>central</id> <name>local private
nexus</name> <url>http: //localhost:8081/nexus/content/groups/public</url> <releases><enabled> true </enabled></releases> <snapshots><enabled> true </enabled></snapshots> </pluginRepository> </pluginRepositories> </profile> ... </profiles> ... <activeProfiles> <!-- 激活 nexus --> <activeProfile>nexus</activeProfile> </activeProfiles> ... </settings> |
原文:http://www.cnblogs.com/leeying/p/3525775.html