如何使用maven命令行创建一个maven项目呢?
下文笔者讲述在cmd中输入相应的命令创建一个maven项目的方法分享,如下所示:
其groupid为com.java265,artifactId 为hellojavatest
实现思路: 1.使用cmd进入指定的目录 2.在cmd中输入以下命令 mvn archetype:generate -DarchetypeCatalog=internal -DgroupId=com.java265 -DartifactId=hellojavatest -DarchetypeArtifactId=maven-archetype-quickstart -Dversion=0.0.1-snapshot使用以上命令即可在cmd所在的工作目录创建一个maven项目
其groupid为com.java265,artifactId 为hellojavatest
D:\tmp>mvn archetype:generate -DarchetypeCatalog=internal -DgroupId=com.java265 -DartifactId=hellojavatest -DarchetypeArtifactId=maven-archetype-quickstart -Dversion=0.0.1-snapshot [WARNING] [WARNING] Some problems were encountered while building the effective settings [WARNING] Unrecognised tag: 'distributionManagement' (position: START_TAG seen ...<!-- \u5b9a\u4e49snapshots\u5e93\u548creleases\u5e93\u7684nexus\u5730\u5740 -->\r\n<distributionManagement>... @79:25) @ D:\Tool\apache-maven-3.8.3\conf\settings.xml, line 79, column 25 [WARNING] [INFO] Scanning for projects... [INFO] [INFO] ------------------< org.apache.maven:standalone-pom >------------------- [INFO] Building Maven Stub Project (No POM) 1 [INFO] --------------------------------[ pom ]--------------------------------- [INFO] [INFO] >>> maven-archetype-plugin:3.2.1:generate (default-cli) > generate-sources @ standalone-pom >>> [INFO] [INFO] <<< maven-archetype-plugin:3.2.1:generate (default-cli) < generate-sources @ standalone-pom <<< [INFO] [INFO] [INFO] --- maven-archetype-plugin:3.2.1:generate (default-cli) @ standalone-pom --- [INFO] Generating project in Interactive mode [INFO] Using property: groupId = com.java265 [INFO] Using property: artifactId = hellojavatest [INFO] Using property: version = 0.0.1-snapshot [INFO] Using property: package = com.java265 Confirm properties configuration: groupId: com.java265 artifactId: hellojavatest version: 0.0.1-snapshot package: com.java265 Y: : y [INFO] ---------------------------------------------------------------------------- [INFO] Using following parameters for creating project from Old (1.x) Archetype: maven-archetype-quickstart:1.0 [INFO] ---------------------------------------------------------------------------- [INFO] Parameter: basedir, Value: D:\tmp [INFO] Parameter: package, Value: com.java265 [INFO] Parameter: groupId, Value: com.java265 [INFO] Parameter: artifactId, Value: hellojavatest [INFO] Parameter: packageName, Value: com.java265 [INFO] Parameter: version, Value: 0.0.1-snapshot [INFO] project created from Old (1.x) Archetype in dir: D:\tmp\hellojavatest [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 11.528 s [INFO] Finished at: 2022-04-28T15:23:33+08:00 [INFO] ------------------------------------------------------------------------
版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。