===== maven字段详解 ===== http://blog.csdn.net/yaerfeng/article/details/26448417
maven中有很多语法,这里我们说说一些常用的语法
<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>4.3.3.Final</version> </dependency>
<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>4.3.3.Final</version> <exclusions> <groupId>dom4j</groupId> <artifactId>dom4j</artifactId><!--无需再声明版本--> </exclusions> </dependency>
<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>4.3.3.Final</version> <scope>test</scope><!--scope标签声明为test,则依赖不会被传递。默认值是之compile,依赖会被传递--> </dependency>
<parent><!--指明父项目的坐标--> <groupId>cn.wp.test</groupId> <artifactId>parent</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../parent/pom.xml</relativePath> </parent>
<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>4.3.3.Final</version> </dependency>
父项目 <dependencyManagement> <dependencies> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>4.3.3.Final</version> </dependency> </dependencies> </dependencyManagement> 子项目 <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId><!--无需再声明版本--> </dependency>
<modules> <module>../main/pom.xml</module><!--指明模块项目的路径--> <module>../model1/pom.xml</module><!--指明模块项目的路径--> </modules>
配置项目pom.xml(声明发布的仓库)
<distributionManagement> <repository><!-- 发布版本发布仓库 --> <id>wepu-releases</id> <name>wepu-releases</name> <url>http://192.168.41.191:8081/nexus/content/repositories/releases/</url> </repository> <snapshotRepository><!-- 快照版本发布仓库 --> <id>wepu-snapshots</id> <name>wepu-snapshots</name> <url>http://192.168.41.191:8081/nexus/content/repositories/snapshots/</url> </snapshotRepository> </distributionManagement>
配置maven 工作区中 settings.xml(发布的权限)
<servers> <server> <id>wepu-releases</id> <username>deployment</username> <password>deployment123</password> </server> <server> <id>wepu-snapshots</id> <username>deployment</username> <password>deployment123</password> </server> </servers>
配置maven 工作区中 settings.xml
<mirrors> <mirror> <id>central</id> <mirrorOf>*</mirrorOf> <!-- 对所有仓库镜像 --> <name>central mirror</name> <url>http://192.168.41.191:8081/nexus/content/groups/public/</url> </mirror> </mirrors>