Transferred from: http://9leg.com/maven/2015/02/01/why-is-mvn-archetype-generate-so-low.html
Recently switched from the community version of IntelliJ idea 14 to Ultimate.
Problem arises
The most recent switch from the community version of IntelliJ idea 14 to Ultimate,key was downloaded from the network. After installation, when you create Maven project (using archetype), it's incredibly slow, and from the idea's console you can see that the information stays in:
[INFO]<<<Maven-Archetype-Plugin2.2:Generate(Default-Cli)<Generate-Sources@Standalone-pom <<<[INFO ][info] --- Maven-archetype-plugin:2.2< Span class= "o" >:generate (default- cli) @ standalone- pom ---[info span class= "n" >generating project in batch mode
Retries many times, all in the generating project in Batch mode waits, but the idea of the status bar display is still running, and did not die, about 30 minutes later to complete the creation of the project.
Problem analysis
Why do you wait so long? I tried it first with MVN's original order,
mvn archetype: generate -dgroupid=com 9leg. App -dartifactid=my- app -darchetypeartifactid=maven -archetype-quickstart - dinteractivemode=false
or generating project in Batch mode has been waiting a long time, but it excludes the question of idea. then add -X command to display debuginfo.
mvn -X archetype:generate -DgroupId=com.9leg.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
The output information is as follows:
[INFO] Generating project in Batch mode[DEBUG] Searching for remote catalog: http://repo1.maven.org/maven2/archetype-catalog.xml
It appears that the Catalog.xml file on the network is being requested, which results in a slow speed. Directly copied the URL opened with a browser, the speed is super slow, wait a long time to open. It appears that the problem is here.
It appears that the Catalog.xml file on the network is being requested, which results in a slow speed. Directly copied the URL opened with a browser, the speed is super slow, wait a long time to open. It appears that the problem is here.
Problem solving
- Download the Archetype-catalog.xml file directly and place it in the local Apache-maven directory.
- When using the MVN archetype:generate command, add -darchetypecatalog=localto replace the catalog.xml on the network.
Okay, OK!!! Also can be happy to set up MAVEN Project!!! Tears ran for a long time!!!
Off Topic
I switched to eclipse, generated a MAVEN project and chose skeleton archetype, without any problems. In Eclipse, you can set up Maven's archetype catalog, either locally or remotely. Switching to idea, looking for half a day, searching for half a day, does not seem to have this setting. You can only set the custom archetype individually when you create the project, and you cannot set the entire archetype list. Who knows please inform, thank you.
Reference: ARCHETYPE-202
"Turn" idea using maven skeleton to build project slow problem