Java知识分享网 - 轻松学习从此开始!    

Java知识分享网

Java1234官方群25:java1234官方群17
Java1234官方群25:838462530
        
SpringBoot+SpringSecurity+Vue+ElementPlus权限系统实战课程 震撼发布        

最新Java全栈就业实战课程(免费)

springcloud分布式电商秒杀实战课程

IDEA永久激活

66套java实战课程无套路领取

锋哥开始收Java学员啦!

Python学习路线图

锋哥开始收Java学员啦!
当前位置: 主页 > Java文档 > Java基础相关 >

Learning Apache Maven PDF 下载


分享到:
时间:2024-06-24 08:02来源:http://www.java1234.com 作者:转载  侵权举报
Learning Apache Maven
失效链接处理
Learning Apache Maven PDF 下载

 
 
相关截图:
 

主要内容:
 

Chapter 2: Access Maven informations in
code
Introduction
It is sometimes useful to get the maven properties, such as the current version, in code. Here are
some ways to to it.
Examples
Getting the version number from within a jar
If you package your application in a jar using the maven-jar-plugin or the maven-assembly-plugin, an
easy way to get the current pom version is to add an entry in the manifest, which is then available
from Java.
The secret is to set the addDefaultImplementationEntries flag to true (and the
addDefaultSpecificationEntries is you also need the artifact id).
jar plugin configuration:

 

<build>
 <plugins>
 <plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-jar-plugin</artifactId>
 <configuration>
 <archive>
 <manifest>
 <mainClass>...</mainClass>
 <addDefaultImplementationEntries>
 true
 </addDefaultImplementationEntries>
 </manifest>
 </archive>
 </configuration>
 </plugin>
 </plugins>
</build>



 

 
------分隔线----------------------------

锋哥公众号


锋哥微信


关注公众号
【Java资料站】
回复 666
获取 
66套java
从菜鸡到大神
项目实战课程

锋哥推荐