2011-11-17 12 views
5

Sto seguendo un tutorial di esperti. Sto cercando di eseguire questo comando che è il mio primo comando di maven. Tutorial dice che creerà una directory chiamata my-app, ma non è così. Questo è il comando & sua uscita, comando:errore Maven BUILD FAILURE

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false 

uscita:

C:\Users\Babar>mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=m 
y-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false 
[INFO] Scanning for projects... 
[INFO] 
[INFO] ------------------------------------------------------------------------ 
[INFO] Building Maven Stub Project (No POM) 1 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] >>> maven-archetype-plugin:2.1:generate (default-cli) @ standalone-pom >> 
> 
[INFO] 
[INFO] <<< maven-archetype-plugin:2.1:generate (default-cli) @ standalone-pom << 
< 
[INFO] 
[INFO] --- maven-archetype-plugin:2.1:generate (default-cli) @ standalone-pom -- 
- 
[INFO] Generating project in Batch mode 
[INFO] ------------------------------------------------------------------------- 
--- 
[INFO] Using following parameters for creating project from Old (1.x) Archetype: 
maven-archetype-quickstart:1.0 
[INFO] ------------------------------------------------------------------------- 
--- 
[INFO] Parameter: groupId, Value: com.mycompany.app 
[INFO] Parameter: packageName, Value: com.mycompany.app 
[INFO] Parameter: package, Value: com.mycompany.app 
[INFO] Parameter: artifactId, Value: my-app 
[INFO] Parameter: basedir, Value: C:\Users\Babar 
[INFO] Parameter: version, Value: 1.0-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 22.971s 
[INFO] Finished at: Fri Nov 18 00:07:12 EET 2011 
[INFO] Final Memory: 6M/11M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2 
.1:generate (default-cli) on project standalone-pom: Directory my-app already ex 
ists - please run from a clean directory -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit 
ch. 
[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 rea 
d the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc 
eption 
'cmd' is not recognized as an internal or external command, 
operable program or batch file. 

msg di errore dice directory esiste già, ma non lo è. Ho eseguito questo comando più di oncw

EDIT

comando (suggerito nella risposta)

mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archet 
    ypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=5-SNAPS 
    HOT 

USCITA

C:\Users\Babar>mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archet 
ypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=5-SNAPS 
HOT 
[INFO] Scanning for projects... 
[INFO] 
[INFO] ------------------------------------------------------------------------ 
[INFO] Building Maven Stub Project (No POM) 1 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] >>> maven-archetype-plugin:2.1:generate (default-cli) @ standalone-pom >> 
> 
[INFO] 
[INFO] <<< maven-archetype-plugin:2.1:generate (default-cli) @ standalone-pom << 
< 
[INFO] 
[INFO] --- maven-archetype-plugin:2.1:generate (default-cli) @ standalone-pom -- 
- 
[INFO] Generating project in Interactive mode 
[INFO] Archetype repository missing. Using the one from [org.apache.maven.archet 
ypes:maven-archetype-quickstart:1.1] found in catalog remote 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 5.552s 
[INFO] Finished at: Fri Nov 18 01:09:15 EET 2011 
[INFO] Final Memory: 6M/12M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2 
.1:generate (default-cli) on project standalone-pom: The desired archetype does 
not exist (org.apache.maven.archetypes:maven-archetype-quickstart:5-SNAPSHOT) -> 
[Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit 
ch. 
[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 rea 
d the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc 
eption 
'cmd' is not recognized as an internal or external command, 
operable program or batch file. 

risposta

0

Noterete che l'errore originale detto

Directory my-app esiste già - si prega eseguito da una nuova directory

Hai forse esegue questo comando da una directory in cui esiste già un progetto Maven (uno con un file pom.xml)? In tal caso, si prega di iniziare con una posizione pulita.

Quando ho eseguito il comando, è stato utilizzato verbatim in una directory vuota, è stato eseguito senza errori e creato una directory denominata my-app.

+0

grazie mille Sri Sankaran. In realtà mi hai dato un indizio per superare la ragione.Cercavo sempre la cartella app my nella cartella di installazione di Maven, non la posizione da cui stavo eseguendo il comando, è il mio primo utilizzo di qualsiasi strumento di automazione build. – enterprize

0

Questa linea è di preoccupazione:

[INFO] base ai seguenti parametri per la creazione di progetti da Old (1.x) Archetipo: Maven-archetipo-Avvio rapido: 1,0

Guardando la pagina di documentazione Maven a http://maven.apache.org/archetype/maven-archetype-bundles/maven-archetype-quickstart/, vedo che il comando si dovrebbe essere utilizzando è:

mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=5-SNAPSHOT 

che non è esattamente quello che si sta eseguendo (vi manca la parte -DarchetypeVersion = 5-SNAPSHOT).

+0

Ho usato questo comando, ma anche provocare accumulo fallire. Ho messo in OP EDIT – enterprize

+0

Anche questo è fallito per me. – Stopher87

1

Prova questo:

mvn archetype:generate -DgroupId="com.mycompany.app" -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false 

le frasi sono state modificate -DgroupId="com.mycompany.app". Devi usare le virgolette.

Ho lavorato su Windows 8 e funziona. Non so se succede su Linux.

1

provate questo, funziona per Maven 3-3-9 per win7 32bit

mvn archetype:generate -DgroupId="com.mycompany.app" -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false