Maven Detail Task

本文介绍Maven项目的POM.xml文件结构及其继承写法,并详细解释如何配置Repository。同时,提供了Maven常用命令一览,帮助开发者快速上手。

Repository 加在POM.xml中還是放在settings.xml中,為什么dotj的沒有放????

 

 

 

 

 

 

 

 

 

POM.XML 继承的写法
<project xmlns="http://maven.apache.org/POM/4.0.0 "
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance "
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd ">
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.apache.hivemind</groupId>
     <artifactId>hivemind-examples</artifactId>
     <packaging>jar</packaging>
     <version>2.0-alpha-1</version>
     <parent>
         <groupId>org.apache.hivemind</groupId>
         <artifactId>hivemind-project</artifactId>
         <version>2.0-alpha-1</version>
         <relativePath>../pom.xml</relativePath>
     </parent>

     <name>HiveMind Examples</name>
     <inceptionYear>2003</inceptionYear>
     <dependencies>
         <dependency>
             <groupId>org.apache.hivemind</groupId>
             <artifactId>hivemind-framework</artifactId>
             <version>2.0-alpha-1</version>
         </dependency>

 

 

 

 

 

 

 

 

 

 

下面就是一些goal命令了,这里和Maven1有不少不同,常用的命令有:

创建Maven的普通java项目:mvn archetype:create -DgroupId=com.codeline.commons -DartifactId=pjoName     创建Maven的Web项目:mvn archetype:create -DgroupId=com.mycompany.app     -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp     编译源代码:mvn compile (或者:mvn compiler:compile)    编译测试代码:mvn test-compile     运行测试:mvn test     产生site:mvn site     打包:mvn package     在本地Repository中安装jar:mvn install     清除产生的项目:mvn clean     生成eclipse项目:mvn eclipse:eclipse    生成idea项目:mvn idea:idea    组合使用goal命令,如只打包不测试:mvn -Dtest package     编译测试的内容:mvn test-compile    只打jar包: mvn jar:jar    只测试而不编译,也不测试编译:mvn test -skipping compile -skipping test-compile (这里要特别注意 -skipping 的灵活运用,当然也可以用于其他组合命令)    清除eclipse的一些系统设置:mvn eclipse:clean  

 

[ERROR] /var/lib/jenkins/workspace/shpms-yuheng/shpms-api-yuheng/shpms-service/shpms-exchange/src/main/java/com/juyuansoft/shpms/exchange/feign/core/WaterExceedClient.java:[18,5] com.juyuansoft.shpms.exchange.feign.core.WaterExceedClient.DefaultFallback is not abstract and does not override abstract method detailTask(java.lang.Integer,int) in com.juyuansoft.shpms.business.api.WaterExceedApi [INFO] 1 error [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary for shpms-api 1.0-SNAPSHOT: [INFO] [INFO] shpms-api .......................................... SUCCESS [ 0.124 s] [INFO] shpms-base ......................................... SUCCESS [ 6.894 s] [INFO] shpms-service-api .................................. SUCCESS [ 0.020 s] [INFO] shpms-core-api ..................................... SUCCESS [ 28.520 s] [INFO] jy-service ......................................... SUCCESS [ 0.029 s] [INFO] jy-system .......................................... SUCCESS [ 4.301 s] [INFO] shpms-exchange-api ................................. SUCCESS [ 4.579 s] [INFO] shpms-service ...................................... SUCCESS [ 0.017 s] [INFO] shpms-core ......................................... SKIPPED [INFO] shpms-exchange ..................................... FAILURE [ 4.267 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 40.608 s (Wall Clock) [INFO] Finished at: 2025-11-26T18:13:25+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project shpms-exchange: Compilation failure [ERROR] /var/lib/jenkins/workspace/shpms-yuheng/shpms-api-yuheng/shpms-service/shpms-exchange/src/main/java/com/juyuansoft/shpms/exchange/feign/core/WaterExceedClient.java:[18,5] com.juyuansoft.shpms.exchange.feign.core.WaterExceedClient.DefaultFallback is not abstract and does not override abstract method detailTask(java.lang.Integer,int) in com.juyuansoft.shpms.business.api.WaterExceedApi [ERROR] [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException [ERROR] [ERROR] After correcting the problems, you can resume the build with the command [ERROR] mvn <goals> -rf :shpms-exchange Build step 'Execute shell' marked build as failure Finished: FAILURE
11-27
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值