TeamCity插件开发maven失败

时间:2017-03-14 19:37:25

标签: maven plugins teamcity maven-plugin maven-archetype

我正在关注https://confluence.jetbrains.com/display/TCD10/Getting+Started+with+Plugin+Development

的插件开发教程

在我执行命令的步骤2中:

mvn archetype:generate -DarchetypeRepository=http://download.jetbrains.com/teamcity-repository -DarchetypeArtifactId=teamcity-server-plugin -DarchetypeGroupId=org.jetbrains.teamcity.archetypes -DarchetypeVersion=RELEASE

我收到以下错误:

[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> maven-archetype-plugin:3.0.0:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO] 
[INFO] <<< maven-archetype-plugin:3.0.0:generate (default-cli) < generate-sources @ standalone-pom <<<
[INFO] 
[INFO] --- maven-archetype-plugin:3.0.0:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Interactive mode
[WARNING] Archetype not found in any catalog. Falling back to central repository (http://repo.maven.apache.org/maven2).
[WARNING] Use -DarchetypeRepository=<your repository> if archetype's repository is elsewhere.
Downloading: http://repo.maven.apache.org/maven2/org/jetbrains/teamcity/archetypes/teamcity-server-plugin/maven-metadata.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.638 s
[INFO] Finished at: 2017-03-14T11:24:41-06:00
[INFO] Final Memory: 14M/185M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.0.0:generate (default-cli) on project standalone-pom: The desired archetype does not exist (org.jetbrains.teamcity.archetypes:teamcity-server-plugin:RELEASE) -> [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/MojoFailureException

有关如何使其发挥作用的任何想法?

3 个答案:

答案 0 :(得分:3)

Maven Archetype 3.0.0删除了archetypeRepository参数,请参阅https://issues.apache.org/jira/browse/ARCHETYPE-439

因此,您必须将远程原型存储库添加到settings.xml中。转到[users] /。m2文件夹,创建/编辑settings.xml,如:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                          https://maven.apache.org/xsd/settings-1.0.0.xsd">
  <profiles>
    <profile>
      <id>teamcity</id>
      <repositories>
        <repository>
          <id>teamcity-repository</id>
          <name>Teamcity Repository</name>
          <url>http://download.jetbrains.com/teamcity-repository</url>
          <layout>default</layout>
        </repository>
      </repositories>          
    </profile>
  </profiles>
</settings>

然后在命令行中执行maven

 mvn archetype:generate -P teamcity -DarchetypeArtifactId=teamcity-server-plugin -DarchetypeGroupId=org.jetbrains.teamcity.archetypes -DarchetypeVersion=RELEASE

答案 1 :(得分:1)

修改%M2_HOME%\ conf \ settings.xml

中的镜像
<mirrors>
  <mirror>
    <id>google-maven-central</id>
    <name>Google Maven Central</name>
    <url>https://maven-central.storage.googleapis.com</url>
    <mirrorOf>central</mirrorOf>
  </mirror> 
</mirrors> 

这个答案是在以下内容中找到的: https://stackoverflow.com/a/42407332/1937339

答案 2 :(得分:1)

正确的命令是

mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeRepository=http://download.jetbrains.com/teamcity-repository -DarchetypeArtifactId=teamcity-server-plugin -DarchetypeGroupId=org.jetbrains.teamcity.archetypes -DarchetypeVersion=RELEASE

(使用固定版本的原型插件)

文档将相应更新。