我正在尝试按照此处指定的说明进行操作: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
编辑:在听完Charlee的建议之后,我收到了这些警告。
[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] ------------------------------------------------------------------------
看起来它仍然无法找到原型,然后转到另一个存储库,所以这不是我想要的。 如果我将archetype版本的参数更改为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-快照的任何建议?
答案 0 :(得分:1)
由于默认情况下名为jive.archiva
的配置文件未处于活动状态。 AFAIK,有以下两种可能的方式: -
1.通过指定配置文件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中的配置文件时自动停用 。
请参阅Introduction to Build Profiles的更多信息。
我希望这可能有所帮助。