Maven原型目录:指定自定义位置

Ben*_*min 9 nexus maven maven-archetype

我正在为Maven部署一个Nexus存储库,并在其上部署自定义原型.

我想执行 mvn archetype:generate并提示内部+自定义原型列表.

我发现提示自定义原型的唯一方法(以符合人体工程学的方式,即没有URL)是将原型 - 目录路径定义为设置中的属性.这不是一个有效的解决方案,因为我想要几个目录(并且在CLI中不能覆盖此属性).

有没有人知道如何做到这一点?

提前致谢,


[编辑]我发现了一个相关的问题报告:http://jira.codehaus.org/browse/ARCHETYPE-273

我注意到,在期间archetype:generate,maven试图到达中央存储库:

[DEBUG] Searching for remote catalog: http://repo1.maven.org/maven2/archetype-catalog.xml
[DEBUG] Searching for remote catalog: http://repo1.maven.org/maven2
Run Code Online (Sandbox Code Playgroud)

它以"连接超时"结束,因为我没有(也不想)指定代理...

我不明白为什么maven不检查nexus目录...

ler*_*yse 6

我还有一个Nexus配置为镜像Maven存储库,因此也镜像远程目录.

<mirror>
    <!--This sends everything else to /public -->
    <id>nexus</id>
    <mirrorOf>*</mirrorOf>
    <url>http://afbwt03:8081/nexus/content/groups/JavaRepo/</url>
</mirror>
Run Code Online (Sandbox Code Playgroud)

和:

<profile>
    <id>nexus</id>
    <repositories>
        <repository>
            <id>central</id>
            <url>http://central</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>central</id>
            <url>http://central</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>
</profile>
Run Code Online (Sandbox Code Playgroud)

只有在使用以下Maven命令行时才能访问远程目录:

mvn archetype:generate -DarchetypeCatalog=http://afbwt03:8081/nexus/content/groups/JavaRepo
Run Code Online (Sandbox Code Playgroud)

如果我没有定义archetypeCatalog变量,我会得到与您相同的行为:尝试访问repo1....虽然配置了一些镜像.