java - Maven - 如何从原型创建项目
问题描述
我是 maven 的新手,我必须从原型 archetype-2jse-simple-1.1.1 创建项目,我在本地目录中有它。你能帮我在终端中使用什么控制台命令吗?我只知道我必须使用 mvn archetype:generate。我尝试了几次,但我不知道运行我的本地原型。
解决方案
在 maven 中使用时,archetype:generate
您可以指定用于生成 maven 项目的原型。
mvn archetype:generate -DarchetypeGroupId=<archetype group id> -DarchetypeArtifactId=<archetype artifactid> -DarchetypeVersion=<archetype version>
例如,如果您的原型的 groupId 是cz.swigroup
并且原型 artifactId 是archetype-2jse-simple
并且版本是1.1.1
那么命令将是。
mvn archetype:generate -DarchetypeGroupId=cz.swigroup -DarchetypeArtifactId=archetype-2jse-simple -DarchetypeVersion=1.1.1
更新
由于工件不是来自中央存储库,而是来自https://artifactory.cs.vsb.cz/libs-release-local/
您必须在~/.m2/settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<profiles>
<profile>
<id>maven-repositories</id>
<repositories>
<repository>
<id>artifactory.cs.vsb.cz</id>
<name>artifactory.cs.vsb.cz</name>
<url>https://artifactory.cs.vsb.cz/libs-release-local/</url>
</repository>
</profile>
</profiles>
<activeProfiles>
<activeProfile>maven-repositories</activeProfile>
</activeProfiles>
</settings>
推荐阅读
- ios - 如何使用 Xamarin 在 OnAppearing() 方法中显示获奖广告
- excel - 在记录的 Pivot 宏上获取运行时错误 5
- javascript - JS - SyntaxError:标识符“financeManager”已经被声明
- c# - 我们可以从同一个可执行文件中调试 .csx(添加断点和监视变量状态)吗?
- python - Django 记录器设置
- reactjs - onClick 不会从 Child 组件更新 Parent 的状态
- sql - 'SQLNCLI10.1' 提供程序未在 VS 2019 的本地计算机上注册
- docker - 如何在 ECS 中查看绑定挂载路径中的目录
- r - 分层ggplot
- python - 有人可以告诉我一个更有效/更短的方法来编写这个 python random # 程序吗?