1

我正在尝试按照此处指定的说明进行操作:https ://community.jivesoftware.com/docs/DOC-3544

出于某种原因,当我执行时:

mvn archetype:generate -e -B -DarchetypeGroupId=com.jivesoftware.maven -DarchetypeArtifactId=maven-jive-archetype -DarchetypeVersion=6.0.x-SNAPSHOT -DgroupId=com.jivesoftware.dummycustomer -DartifactId=dummyCustomerSite  

它似乎无法找到原型。

我相信我已经在 ~/.m2/settings.xml 中添加了我需要的所有更改(即代理设置、配置文件和 jive 凭据)

<?xml version="1.0"?>
<settings>
  <profiles>
    <profile>
        <id>jive.archiva</id>
        <activation>
            <activeByDefault>false</activeByDefault>
        </activation>
        <repositories>
            <repository>
                <id>jive.internal</id>
                <name>Jive's Repository</name>
                <url>https://maven-secure.jivesoftware.com/archiva/repository/jive.internal</url>
            </repository>

            <repository>
                <id>jive.snapshots</id>
                <name>Jive's Repository</name>
                <url>https://maven-secure.jivesoftware.com/archiva/repository/jive.snapshots</url>
            </repository>
        </repositories>

        <pluginRepositories>
            <pluginRepository>
                <id>jive.internal</id>
                <name>Jive's Repository</name>
                <url>https://maven-secure.jivesoftware.com/archiva/repository/jive.internal</url>
            </pluginRepository>

            <pluginRepository>
                <id>jive.snapshots</id>
                <name>Jive's Repository</name>
                <url>https://maven-secure.jivesoftware.com/archiva/repository/jive.snapshots</url>
            </pluginRepository>
        </pluginRepositories>

        <properties>
            <tomcat6.home><![CDATA[/usr/local/apache-tomcat-6.0.36]]></tomcat6.home>
            <cargo.wait>false</cargo.wait>
            <jive.setup>true</jive.setup>
            <jive.devMode>true</jive.devMode>
            <pluginDirs>null</pluginDirs>
        </properties>
    </profile>
</profiles>
<servers>
 <server>
    <id>jive.internal</id>
    <username>john.smith</username>
    <password>password123</password>
 </server>
 <server>
    <id>jive.snapshots</id>
    <username>john.smith</username>
    <password>password123</password>
 </server>
 <server>
    <id>central</id>
    <username>john.smith</username>
    <password>password123</password>
 </server>

   <proxies>
    <proxy>
     <active>true</active>
     <protocol>http</protocol>
     <host>proxy.mycompany.com</host>
     <port>8080</port>
     <nonProxyHosts>*.mycompany.com|localhost</nonProxyHosts>
    </proxy>
   </proxies>
    </settings>

运行时,Maven 说找不到文件:

$mvn archetype:create -DarchetypeGroupId=com.jivesoftware.maven -DarchetypeArtifactId=maven-jive-archetype -DarchetypeVersion=5.0.x-SNAPSHOT -DgroupId=com.cirrus.jive -DartifactId=tap
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-archetype-plugin:2.2:create (default-cli) @ standalone-pom ---
[WARNING] This goal is deprecated. Please use mvn archetype:generate instead
[INFO] Defaulting package to group ID: com.cirrus.jive
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.116s
[INFO] Finished at: Thu Apr 11 16:17:50 CDT 2013
[INFO] Final Memory: 7M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:create (default-cli) on project standalone-pom: Error creating from archetype: org.apache.maven.archetype.downloader.DownloadNotFoundException: Requested com.jivesoftware.maven:maven-jive-archetype:jar:5.0.x-SNAPSHOT download does not exist. Could not find artifact com.jivesoftware.maven:maven-jive-archetype:jar:5.0.x-SNAPSHOT
[ERROR] 
[ERROR] Try downloading the file manually from the project website.
[ERROR] 
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=com.jivesoftware.maven -DartifactId=maven-jive-archetype -Dversion=5.0.x-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file
[ERROR] 
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=com.jivesoftware.maven -DartifactId=maven-jive-archetype -Dversion=5.0.x-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR] 
[ERROR] 
[ERROR] com.jivesoftware.maven:maven-jive-archetype:jar:5.0.x-SNAPSHOT
[ERROR] 
[ERROR] from the specified remote repositories:
[ERROR] central (http://repo1.maven.org/maven2, releases=true, snapshots=false)
[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/MojoExecutionException

编辑:遵循查理的建议后,我收到了这些警告。

[WARNING] Archetype not found in any catalog. Falling back to central repository (http://repo1.maven.org/maven2).
[WARNING] Use -DarchetypeRepository=<your repository> if archetype's repository is elsewhere.
Downloading: http://repo1.maven.org/maven2/com/jivesoftware/maven/maven-jive-archetype/6.0.x-SNAPSHOT/maven-metadata.xml
Downloading: http://repo1.maven.org/maven2/com/jivesoftware/maven/maven-jive-archetype/6.0.x-SNAPSHOT/maven-metadata.xml
...
...
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.245s
[INFO] Finished at: Fri Apr 12 10:03:30 CDT 2013
[INFO] Final Memory: 7M/81M
[INFO] ------------------------------------------------------------------------

看起来它仍然找不到原型,然后转到另一个存储库,所以这不是我想要的。如果我将原型版本的参数更改为 5.0(我认为我的公司可能希望我使用它)。设置 DarchetypeVersion=5.0.x-SNAPSHOT 给了我这个(注意它说 xxxx 实际上应该说 http 因为 stackoverflow 抱怨我由于缺乏声誉而无法发布 html 链接):

[WARNING] Archetype not found in any catalog. Falling back to central repository (http://repo1.maven.org/maven2).
[WARNING] Use -DarchetypeRepository=<your repository> if archetype's repository is elsewhere.
Downloading: xxxx://repo1.maven.org/maven2/com/jivesoftware/maven/maven-jive-archetype/5.0.x-SNAPSHOT/maven-metadata.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.009s
[INFO] Finished at: Fri Apr 12 10:08:44 CDT 2013
[INFO] Final Memory: 7M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli) on project standalone-pom: The desired archetype does not exist (com.jivesoftware.maven:maven-jive-archetype:5.0.x-SNAPSHOT) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli) on project standalone-pom: The desired archetype does not exist (com.jivesoftware.maven:maven-jive-archetype:5.0.x-SNAPSHOT)

关于为什么我似乎找不到 5.0.x- 快照的任何建议?

4

1 回答 1

1

由于命名的配置文件jive.archiva默认情况下是不活动的。AFAIK,有以下两种可能的方法:-

1.通过指定profile id来执行maven。

mvn archetype:generate -e -B 
   -P jive.archiva 
   -DarchetypeGroupId=com.jivesoftware.maven 
   -DarchetypeArtifactId=maven-jive-archetype 
   -DarchetypeVersion=6.0.x-SNAPSHOT 
   -DgroupId=com.jivesoftware.dummycustomer 
   -DartifactId=dummyCustomerSite  

2.通过缺少一些系统属性使配置文件处于活动状态。

<profiles>
    <profile>
        <id>jive.archiva</id>
        <activation>
            <activeByDefault>false</activeByDefault>
            <property>
               <name>!disableJive</name>
            </property>
        </activation>
    </profile>
</profile>

您可能想知道为什么我们不使用<activeByDefault>true</activeByDefault>. 这里可能是答案

除非使用上述方法之一激活同一 POM 中的另一个配置文件,否则此配置文件将自动对所有构建处于活动状态。当在命令行或通过其激活配置激活 POM 中的配置文件时,默认情况下处于活动状态的所有配置文件都会自动停用。

请参阅构建配置文件简介中的更多信息。

我希望这可能会有所帮助。

于 2013-04-12T02:28:12.010 回答