繁体   English   中英

Maven - 如何从原型创建项目

[英]Maven - How create project from archetype

我是 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>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM