依赖管理

   

    Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.

 

版本统一仲裁控制

项目的pom.xml中加入

 <dependencyManagement>

  <dependencies>

   <dependency>

    <groupId>junit</groupId>

    <artifactId>junit</artifactId>

    <version>4.11</version>

    <scope>test</scope>

   </dependency>

  </dependencies>

 </dependencyManagement>

 

编译版本控制

项目的pom.xml中加入

 <properties>

  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

  <jdk.version>1.8</jdk.version>

 </properties>

 

 <build>

  <pluginManagement>

   <plugins>

    <plugin>

     <groupId>org.apache.maven.plugins</groupId>

     <artifactId>maven-compiler-plugin</artifactId>

     <version>3.2</version>

     <configuration>

      <source>${jdk.version}</source>

      <target>${jdk.version}</target>

      <encoding>${project.build.sourceEncoding}</encoding>

      <compilerArguments>

       <verbose/>

       <bootclasspath>${java.home}/lib/rt.jar</bootclasspath>

      </compilerArguments>

     </configuration>

    </plugin>

   </plugins>

  </pluginManagement>

 </build>

 

发布管理配置

项目的pom.xml中加入

 <distributionManagement>

  <repository>

   <id>releases</id>

   <url>http://127.0.0.1:8081/nexus/content/repositories/releases/</url>

  </repository>

  <snapshotRepository>

   <id>snapshot</id>

   <url>http://127.0.0.1:8081/nexus/content/repositories/snapshots/</url>

  </snapshotRepository>

 </distributionManagement>

 

maven settings.xml 配置

 

1、servers配置

  <server>

   <id>releases</id>

   <username>admin</username>

   <password>admin123</password>

  </server>

  <server>

   <id>snapshot</id>

   <username>admin</username>

   <password>admin123</password>

  </server>

2、mirrors配置

  <mirror>

   <id>nexus</id>

   <url>http://127.0.0.1:8081/nexus/content/groups/public/</url>

   <mirrorOf>*</mirrorOf>

  </mirror>

3、profiles配置

  <profile>

   <id>myprofile</id>

   <repositories>

    <repository>

     <id>public</id>

     <url>http://127.0.0.1:8081/nexus/content/groups/public/</url>

     <releases>

      <enabled>true</enabled>

     </releases>

     <snapshots>

      <enabled>true</enabled>

     </snapshots>

    </repository>

   </repositories>

   <pluginRepositories>

    <pluginRepository>

     <id>public</id>

     <url>http://127.0.0.1:8081/nexus/content/groups/public/</url>

     <releases>

      <enabled>true</enabled>

     </releases>

     <snapshots>

      <enabled>false</enabled>

     </snapshots>

    </pluginRepository>

   </pluginRepositories>

  </profile>

4、activeProfiles配置

  <activeProfile>myprofile</activeProfile>

 

继续阅读  

Maven最佳实践:版本管理

 http://juvenshun.iteye.com/blog/376422

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值