maven学习笔记

研究了几个maven的问题,在这里记录一下:

1.在构建的时候自动生成javadoc和source包,需要在pom中添加如下内容

<execution> 
  <phase>package</phase>
     <goals> 
       <goal>jar</goal> 
     </goals> 
</execution>

 

  如果phase不写的话在mvn package执行时候将不会执行这段

2.发布source, javadoc, binary jar包:

maven 发布三步: 
mvn clean install 
mvn release:prepare 
mvn release:perform 
如果不想在部署时候把javadoc和sourece传上去可做如下配置:

 
 
<plugins> 
<plugin> 
<groupId>org.apache.maven.plugins</groupId> 
<artifactId>maven-release-plugin</artifactId> 
<configuration> 
<tagBase>http://*****/tags/</tagBase> <useReleaseProfile>false</useReleaseProfile> 
</configuration> 
</plugin> 
</plugins>
   3.如果想将自己的构件发布到远程中央仓库可以在pom中增加如下配置:
<distributionManagement> 

<repository> 
<id>releases</id> 
<name>releases</name> <url>http://hostname/nexus/repositories/releases/</url> </repository> 

<snapshotRepository> 
<id>snapshots</id> 
<name>snapshots</name> <url>http://hostname/nexus/repositories/snapshots/</url> </snapshotRepository>
 
</distributionManagement> 
   
 4. maven构件中的坐标包含四个要素: {groupId, artifactId, type, classifier},type默认是jar, classifier,这个实际没用到过
官方文档 写道
The classifier of the dependency. This allows distinguishing two artifacts that belong to the same POM but were built differently, and is appended to the filename after the version. For example, jdk14 and jdk15

 

5.可以从maven-metadata.xml 中看出当前最新版本,以及一些build信息

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值