kolorobot / spring-mvc-quickstart-archetype

The project is a Maven archetype for Spring MVC web application.
http://blog.codeleak.pl
1.05k stars 478 forks source link

Can't Successfully run mvn archetype:generate command #50

Closed javasavvy closed 10 years ago

javasavvy commented 10 years ago

Hi I am trying to use your project but I am having some trouble. I am geting the error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli) on project spring-mvc-quickstart: org.apache.maven.archetype.exception.InvalidPackaging: Unable to add module to the current project as it is not of packaging type 'pom' -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli) on project spring-mvc-quickstart: org.apache.maven.archetype.exception.InvalidPackaging: Unable to add module to the current project as it is not of packaging type 'pom'

Is this because I am using Maven 3 and not Maven 2?

The full command I am running is

mvn archetype:generate \ -DarchetypeGroupId=com.github.spring-mvc-archetypes \ -DarchetypeArtifactId=spring-mvc-quickstart \ -DarchetypeVersion=1.0.0-SNAPSHOT \ -DgroupId=Reloader \ -DartifactId=Reloader \ -Dversion=1 -e

Maybe I am doing something incorrectly?

I did try adding pom to the root POM but that gave me a new error about \ being an invalid life-cycle.

kolorobot commented 10 years ago

It seems that you are trying to generate a project but the pom already exists. Do you confirm this? Did you solve this issue?

javasavvy commented 10 years ago

Hi, I have not resolved this, I was going to try a different archetype but I got busy. I'm not sure what you mean by the POM already exists, where should I be looking for this POM? In the repository? Perhaps the plugin is not compatible with maven 3? I mean I downloaded and extracted the zip file which has a pom file in it, so that pom certainly exists.

I just tried again from a PC at work that has Maven2, but perhaps there is a problem with the proxy here...

C:\dev\test\spring-mvc-quickstart-archetype-master>mvn archetype:generate \ -Dar chetypeGroupId=com.github.spring-mvc-archetypes \ -DarchetypeArtifactId=spring-m vc-quickstart \ -DarchetypeVersion=1.0.0-SNAPSHOT \ -DgroupId=Reloader \ -Dartif actId=Reloader \ -Dversion=1 -e [INFO] Error stacktraces are turned on. [INFO] Scanning for projects... [INFO]

[INFO]

[INFO] Building Spring MVC Maven Archetype: Quickstart 1.0.0-SNAPSHOT

[INFO]

[INFO] [INFO] >>> maven-archetype-plugin:2.2:generate (default-cli) @ spring-mvc-quicks tart >>> [INFO] [INFO] <<< maven-archetype-plugin:2.2:generate (default-cli) @ spring-mvc-quicks tart <<< [INFO] [INFO] --- maven-archetype-plugin:2.2:generate (default-cli) @ spring-mvc-quicks tart --- [INFO] Generating project in Interactive mode [WARNING] Archetype not found in any catalog. Falling back to central repository (http://repo1.maven.org/maven2). [WARNING] Use -DarchetypeRepository= if archetype's repository is elsewhere. Downloading: http://repo1.maven.org/maven2/com/github/spring-mvc-archetypes/spri ng-mvc-quickstart/1.0.0-SNAPSHOT/maven-metadata.xml Downloading: http://repo1.maven.org/maven2/com/github/spring-mvc-archetypes/spri ng-mvc-quickstart/1.0.0-SNAPSHOT/spring-mvc-quickstart-1.0.0-SNAPSHOT.jar [INFO]

[INFO]

[INFO] Skipping Spring MVC Maven Archetype: Quickstart [INFO] This project has been banned from the build due to previous failures.

[INFO]

[INFO]

[INFO] BUILD FAILURE

[INFO]

[INFO] Total time: 6.479s [INFO] Finished at: Tue Mar 18 14:32:21 PDT 2014 [INFO] Final Memory: 11M/184M

[INFO]

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2 .2:generate (default-cli) on project spring-mvc-quickstart: The desired archetyp e does not exist (com.github.spring-mvc-archetypes:spring-mvc-quickstart:1.0.0-S NAPSHOT) -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o rg.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli) on pro ject spring-mvc-quickstart: The desired archetype does not exist (com.github.spr ing-mvc-archetypes:spring-mvc-quickstart:1.0.0-SNAPSHOT) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor .java:213) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor .java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor .java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje ct(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje ct(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu ild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl eStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun cher.java:290) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav a:230) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La uncher.java:409) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java: 352) Caused by: org.apache.maven.plugin.MojoFailureException: The desired archetype d oes not exist (com.github.spring-mvc-archetypes:spring-mvc-quickstart:1.0.0-SNAP SHOT) at org.apache.maven.archetype.mojos.CreateProjectFromArchetypeMojo.execu te(CreateProjectFromArchetypeMojo.java:221) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default BuildPluginManager.java:101) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor .java:209) ... 19 more Caused by: org.apache.maven.archetype.exception.UnknownArchetype: The desired ar chetype does not exist (com.github.spring-mvc-archetypes:spring-mvc-quickstart:1 .0.0-SNAPSHOT) at org.apache.maven.archetype.ui.generation.DefaultArchetypeGenerationCo nfigurator.configureArchetype(DefaultArchetypeGenerationConfigurator.java:117) at org.apache.maven.archetype.mojos.CreateProjectFromArchetypeMojo.execu te(CreateProjectFromArchetypeMojo.java:205) ... 21 more [ERROR] [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 C:\dev\test\spring-mvc-quickstart-archetype-master>

On Tue, Mar 18, 2014 at 2:01 PM, Rafal Borowiec notifications@github.comwrote:

It seems that you are trying to generate a project but the pom already exists. Do you confirm this? Did you solve this issue?

Reply to this email directly or view it on GitHubhttps://github.com/kolorobot/spring-mvc-quickstart-archetype/issues/50#issuecomment-37987518 .

kolorobot commented 10 years ago

So, when you downloaded the code, did you run: mvn clean install to install the archetype in your local repository?

javasavvy commented 10 years ago

At home yes, but I was in a bit of a rush at work and forgot to do that lol. I also just realized this machine was updated to maven3 at work. Ok So I ran the clean install then re-ran the same command and received the same error I received at home, on the work machine.


org.apache.maven.plugins:maven-archetype-plugin:
.2:generate (default-cli) on project spring-mvc-quickstart:
org.apache.maven.ar
hetype.exception.InvalidPackaging: Unable to add module to the current
project
s it is not of packaging type 'pom' -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
goal
rg.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli)
on pr
ject spring-mvc-quickstart:
org.apache.maven.archetype.exception.InvalidPackagi
g: Unable to add module to the current project as it is not of packaging
type '
om'
        at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecuto
.java:213)
        at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecuto
.java:153)
        at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecuto
.java:145)
        at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProj
ct(LifecycleModuleBuilder.java:84)
        at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProj
ct(LifecycleModuleBuilder.java:59)
        at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedB
ild(LifecycleStarter.java:183)
        at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecyc
eStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
java:57)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Lau
cher.java:290)
        at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.ja
a:230)
        at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(L
uncher.java:409)
        at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java
352)
Caused by: org.apache.maven.plugin.MojoFailureException:
org.apache.maven.arche
ype.exception.InvalidPackaging: Unable to add module to the current project
as
t is not of packaging type 'pom'
        at
org.apache.maven.archetype.mojos.CreateProjectFromArchetypeMojo.exec
te(CreateProjectFromArchetypeMojo.java:211)
        at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Defaul
BuildPluginManager.java:101)
        at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecuto
.java:209)
        ... 19 more
[ERROR]
[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 re
d the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureEx
eption
C:\dev\test\spring-mvc-quickstart-archetype-master>mvn -version
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19
05:51
28-0800)
Maven home: C:\apache-maven-3.0.5
Java version: 1.7.0_10, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_10\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
C:\dev\test\spring-mvc-quickstart-archetype-master>

On Tue, Mar 18, 2014 at 4:06 PM, Rafal Borowiec notifications@github.comwrote:

> So, when you downloaded the code, did you run: mvn clean install to
> install the archetype in your local repository?
> 
> ## 
> 
> Reply to this email directly or view it on GitHubhttps://github.com/kolorobot/spring-mvc-quickstart-archetype/issues/50#issuecomment-38000145
> .
> 
> ```
> ```
kolorobot commented 10 years ago

As I wrote earlier, it seems to me that you are running the archetype in the directory where pom.xml already exists. Please try to run it in an empty directory.

javasavvy commented 10 years ago

I'm not sure how that is supposed to work. If I do that I get the following stack trace. [INFO] Error stacktraces are turned on. [INFO] Scanning for projects...

[INFO]

[INFO] BUILD FAILURE

[INFO]

[INFO] Total time: 0.052 s [INFO] Finished at: 2014-03-19T01:09:19-08:00 [INFO] Final Memory: 4M/244M

[INFO]

[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Development\reloader). Please verify you invoked Maven from the correct directory. -> [Help 1] org.apache.maven.lifecycle.MissingProjectException: The goal you specified requires a project to execute but there is no POM in this directory (C:\Development\reloader). Please verify you invoked Maven from the correct directory. at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:80) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213) at org.apache.maven.cli.MavenCli.main(MavenCli.java:157) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) [ERROR] [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/MissingProjectException

On Tue, Mar 18, 2014 at 11:36 PM, Rafal Borowiec notifications@github.comwrote:

As I wrote earlier, it seems to me that you are running the archetype in the directory where pom.xml already exists. Please try to run it in an empty directory.

Reply to this email directly or view it on GitHubhttps://github.com/kolorobot/spring-mvc-quickstart-archetype/issues/50#issuecomment-38021795 .

kolorobot commented 10 years ago
  1. Download the source
  2. Navigate to the directory
  3. Run mvn install in the directory as described in the doc on the main page (https://github.com/kolorobot/spring-mvc-quickstart-archetype)
  4. Create some new directory (empty) e.g. C:\my-project
  5. Navigate to the directory
  6. Run mvn generate command as described in the doc on the main page (https://github.com/kolorobot/spring-mvc-quickstart-archetype)

And you are done! According to me everything works just fine.

javasavvy commented 10 years ago

I followed those directions and it does not work on 2 different PCs. However I was able to setup the new project using directions for using the archetype in eclipse Kepler. I'm not sure what version of Maven Kepler is using though.

liudianpeng commented 9 years ago

$ mvn archetype:generate -DarchetypeGroupId=org.ninjaframework -DarchetypeArtif actId=ninja-servlet-archetype-simple [INFO] Scanning for projects... Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven -install-plugin/maven-metadata.xml Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven- install-plugin/maven-metadata.xml (623 B at 0.2 KB/sec) Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven -install-plugin/2.5.2/maven-install-plugin-2.5.2.pom Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven- install-plugin/2.5.2/maven-install-plugin-2.5.2.pom (7 KB at 12.1 KB/sec) Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven -install-plugin/2.5.2/maven-install-plugin-2.5.2.jar Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven- install-plugin/2.5.2/maven-install-plugin-2.5.2.jar (33 KB at 38.4 KB/sec) Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven -javadoc-plugin/maven-metadata.xml Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven- javadoc-plugin/maven-metadata.xml (910 B at 1.6 KB/sec) Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven -javadoc-plugin/2.10.3/maven-javadoc-plugin-2.10.3.pom Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven- javadoc-plugin/2.10.3/maven-javadoc-plugin-2.10.3.pom (16 KB at 29.1 KB/sec) Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven -plugins/27/maven-plugins-27.pom Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven- plugins/27/maven-plugins-27.pom (12 KB at 18.8 KB/sec) Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven -javadoc-plugin/2.10.3/maven-javadoc-plugin-2.10.3.jar Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven- javadoc-plugin/2.10.3/maven-javadoc-plugin-2.10.3.jar (396 KB at 90.5 KB/sec) [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building ninja-servlet-archetype-simple 5.1.5-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] >>> maven-archetype-plugin:2.2:generate (default-cli) > generate-sources @ ninja-servlet-archetype-simple >>> [INFO] [INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-banned-dependencies) @ nin ja-servlet-archetype-simple --- [INFO] [INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ ninja-servlet-arc hetype-simple --- [INFO] [INFO] <<< maven-archetype-plugin:2.2:generate (default-cli) < generate-sources @ ninja-servlet-archetype-simple <<< [INFO] [INFO] --- maven-archetype-plugin:2.2:generate (default-cli) @ ninja-servlet-arc hetype-simple --- [INFO] Generating project in Interactive mode 要等待一会会出现以下信息 [INFO] Archetype [org.ninjaframework:ninja-servlet-archetype-simple:5.1.4] found in catalog remote Downloading: https://repo.maven.apache.org/maven2/org/ninjaframework/ninja-servl et-archetype-simple/5.1.4/ninja-servlet-archetype-simple-5.1.4.jar Downloaded: https://repo.maven.apache.org/maven2/org/ninjaframework/ninja-servle t-archetype-simple/5.1.4/ninja-servlet-archetype-simple-5.1.4.jar (13 KB at 4.8 KB/sec) Downloading: https://repo.maven.apache.org/maven2/org/ninjaframework/ninja-servl et-archetype-simple/5.1.4/ninja-servlet-archetype-simple-5.1.4.pom Downloaded: https://repo.maven.apache.org/maven2/org/ninjaframework/ninja-servle t-archetype-simple/5.1.4/ninja-servlet-archetype-simple-5.1.4.pom (3 KB at 4.3 K B/sec) Define value for property 'groupId': :(输入groupid---继续输入) Define value for property 'artifactId': : ninja-servlet-archetype-simple Define value for property 'version': 1.0-SNAPSHOT: : 1.0 Define value for property 'package': org.ninjareamework: : liudianpeng Confirm properties configuration:(确认属性配置) groupId: org.ninjareamework artifactId: ninja-servlet-archetype-simple version: 1.0 package: liudianpeng

Y: :

(Next how to enter)???????????????????????

kolorobot commented 9 years ago

@liudianpeng How your problem is related to this archetype?

You run the following command:

$ mvn archetype:generate -DarchetypeGroupId=org.ninjaframework -DarchetypeArtif actId=ninja-servlet-archetype-simple

See readme for instructions.

liudianpeng commented 9 years ago

@kolorobot what??

kolorobot commented 9 years ago

@liudianpeng You try to generate project using archetype I don't know. So not sure why you are asking this question here.

To use my archetype, you must follow the instructions in readme: https://github.com/kolorobot/spring-mvc-quickstart-archetype

liudianpeng commented 9 years ago

I use a ninja-servlet-archetype-simple

liudianpeng commented 9 years ago

@kolorobot I use a ninja-servlet-archetype-simple

kolorobot commented 9 years ago

@liudianpeng So this is different project then. I will not help you.

wanmifam commented 8 years ago

I have the same problem. I've solved by change following in file pom.xml: <packaging>maven-archetype</packaging>change to <packaging>pom</packaging>

kjayav03 commented 8 years ago

There is a pom in folder where you are running . Remove any pom files on that folder. That should resolve this issue

mvn archetype:generate \ -DarchetypeGroupId=com.github.spring-mvc-archetypes \ -DarchetypeArtifactId=spring-mvc-quickstart \ -DarchetypeVersion=1.0.0-SNAPSHOT \ -DgroupId=Reloader \ -DartifactId=Reloader \ -Dversion=1

kolorobot commented 8 years ago

@kjayav03 More people with this issue, what about adding this to readme?

kjayav03 commented 8 years ago

@kolorobot Fine by me :)

OussamaAouni commented 8 years ago

Me too, I resolved my problem by removing the pom.xml file from the folder ... Thank you @kjayav03

Like you said, it'll be better to add this to the readme ... ;)