1

I am following the plugin development tutorial from https://confluence.jetbrains.com/display/TCD10/Getting+Started+with+Plugin+Development

On step 2 when I run the command:

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

I get the following error:

[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

Any ideas on how to get this to work?

fractalflame
  • 1,011
  • 1
  • 9
  • 20

3 Answers3

3

Maven Archetype 3.0.0 removed archetypeRepository parameter, see https://issues.apache.org/jira/browse/ARCHETYPE-439

So you have to add the remote archetype repository into your settings.xml. Go to your [users]/.m2 folder, create/edit the settings.xml likes that:

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

Then execute maven in your command line

 mvn archetype:generate -P teamcity -DarchetypeArtifactId=teamcity-server-plugin -DarchetypeGroupId=org.jetbrains.teamcity.archetypes -DarchetypeVersion=RELEASE
Jason Hu
  • 99
  • 6
1

Modify the mirrors in %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> 

This answer was found within: https://stackoverflow.com/a/42407332/1937339

Community
  • 1
  • 1
Dave Horner
  • 405
  • 5
  • 10
1

Correct command is

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

(uses fixed version of archetype plugin)

The documentation will be updated accordingly.

Nikita Skvortsov
  • 4,768
  • 24
  • 37
  • 1
    please check that you use documentation of up-to-date TeamCity build: https://confluence.jetbrains.com/display/TCD10/Developing+Plugins+Using+Maven – Nikita Skvortsov Jul 24 '17 at 06:48
  • What is the point of keeping command that leads to errors in documentation even if that is not up-to-date documentation? Maybe adding a note "this command doesn't work but we anyway provide it for some reason" will help. Users are not familiar with Jetbrains infrastructure, Google led them to the page with invalid command, that is enough for them to leave. – nickolay.laptev Jul 24 '17 at 07:56
  • 1
    the 9.0 documentation will be updated as well soon. Sorry for the inconvenience and thank you for letting us know. – Nikita Skvortsov Jul 24 '17 at 09:24