13

I am trying to create a Jave Web project with following Maven command

mvn archetype:generate -DgroupId=com.mazhar.event -DartifactId=EventBook2 -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false

and the process is stuck on Genrating project in batch mode

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.3:generate (default-cli) @ standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:2.3:generate (default-cli) @ standalone-pom <<<
[INFO]
[INFO] --- maven-archetype-plugin:2.3:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Batch mode

Here is my system details

mvn -vsersion
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 20:22:22+0500)
Maven home: D:\servers\apache-maven\bin\..
Java version: 1.6.0_32, vendor: Sun Microsystems Inc.
Java home: C:\Program Files (x86)\Java\jdk1.6.0_32\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
8
  • Which Maven version are you using?
    – hzpz
    Jul 16, 2015 at 11:51
  • its 3.1.1, I have added the details in question as well. Jul 16, 2015 at 11:55
  • 2
    Did you try without -DinteractiveMode=false?
    – hzpz
    Jul 16, 2015 at 12:05
  • I first ran without interactive it was quick, then I ran again with interactive, this time it was quick. after some time I ran with interactive its now stuck again (It eventually creates the project but take too much time). I think its some problem with internet (or resource) its trying to access. Jul 16, 2015 at 12:30
  • 1
    Try adding -X to the command and watch the output after Generating project in Batch mode.
    – hzpz
    Jul 16, 2015 at 12:45

5 Answers 5

17

Add -X to your command to enable Maven's debug logging.

If it's stuck on something like

[DEBUG] Searching for remote catalog: http://repo.maven.apache.org/maven2/archetype-catalog.xml

you probably have a connection problem. Since it has been working for you before, you obviously don't need to configure a proxy. Instead - since you are using Windows - my guess is, that your virus scanner/personal firewall is blocking or rather "scanning" the connection, resulting in a slow response. Try temporarily disabling your virus scanner/personal firewall and see if that helps.

1
  • Yes, this helped - for me, I saw Searching for remote catalog: and fixed my connection.
    – flow2k
    Sep 23, 2018 at 19:12
14

You can simply use local archetype-catalog.xml file instead of the remote one.

The option -DarchetypeCatalog=internal can do it well.

So, you are going to generate your project instantly now:

mvn -B archetype:generate -DarchetypeCatalog=internal -DgroupId=com.mycompany.app -DartifactId=my-app
1
  • Thank you! That's what I needed.
    – mate00
    Feb 21, 2019 at 14:39
3

Since maven is trying to lookup for archetypeArtifactId on https://artifactory.corp.chartercom.com/libs-release/archetype-catalog.xml which is having data of size more than 6.7 MB. And it stuck here at line...

Searching for remote catalog: https://artifactory.corp.chartercom.com/libs-release/archetype-catalog.xml

Solution:-

  1. Download archetype-catalog.xml from https://artifactory.corp.chartercom.com/libs-release/archetype-catalog.xml
  2. Keep it on ~/.m2/archetype-catalog.xml
  3. Run your mvn command again with -DarchetypeCatalog=internal option
1

If you let it stuck long enough, and you have an error like this:

[WARNING] Error reading archetype catalog http://repo.maven.apache.org/maven2 org.apache.maven.wagon.TransferFailedException: Connect to repo.maven.apache.org:80 [repo.maven.apache.org/23.235.43.215] failed: Connection timed out: connect

You'll have to set the maven proxy.

I tried the same command as you, and it did generate the project (in interactive and non-interactive modes), so it must be you trying to reach the maven repo that is blocking the project generation.

0

I faced the same problem. But in my case, I just want to create a java project with maven command.

Those who are facing the same issue and their only aim is to just create a project then go for the command without -DinteractiveMode=false option.

First I tried this command:

mvn archetype:generate -DgroupId=com.manan.firstexample -DartifactId=firstexample -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false -X

at that time the command is stuck and got following error:

[INFO] Generating project in Batch mode
[DEBUG] Searching for remote catalog: http://repo.maven.apache.org/maven2/archetype-catalog.xml 

Then i tried command without DinteractiveMode option:

mvn archetype:generate -DgroupId=com.manan.firstexample -DartifactId=firstexample -DarchetypeArtifactId=maven-archetype-quickstart -X

So, I got this error

Caused by java.net.ConnectionException: Connection Timed out: connect

But do not worry. It has created a project. (Which solves my problem)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.