Quiero crear un arquetipo a partir de un proyecto existente, para lo cual me sitúo en el directorio dónde esta el POM.XML
de este proyecto y ejecuto la instrucción
mvn archetype:create-from-project
obteniendo como resultado
java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
Tengo instalada la versión 3.3.9 de Maven, y utilizo JDK 1.8. Además, como podéis ver en la traza, la librería common-lang existe en mi repositorio de librerías ( aunque parece estar usando la 2.4 cuando he comprobado que tengo descargada también la 2.6 ).
He probado también con otras instrucciones maven como "generate" y siempre dá el mismo error.
Por otro lado, el proyecto compila sin problemas.
Esta es la traza del error
> [INFO] Scanning for projects... [INFO]
> [INFO]
> ------------------------------------------------------------------------ [INFO] Building EncodeDetectorLibrary 0.0.1-SNAPSHOT [INFO]
> ------------------------------------------------------------------------ [INFO] [INFO] >>> maven-archetype-plugin:3.0.0:create-from-project
> (default-cli) > generate-sources @ EncodeDetectorLibrary >>> [INFO]
> [INFO] <<< maven-archetype-plugin:3.0.0:create-from-project
> (default-cli) < generate-sources @ EncodeDetectorLibrary <<< [INFO]
> [INFO] --- maven-archetype-plugin:3.0.0:create-from-project
> (default-cli) @ EncodeDetectorLibrary --- [WARNING] Error
> initializing:
> org.codehaus.plexus.velocity.DefaultVelocityComponent@5a12c728
> java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
> at org.apache.velocity.runtime.resource.ResourceManagerImpl.initialize(ResourceManagerImpl.java:161)
> at org.apache.velocity.runtime.RuntimeInstance.initializeResourceManager(RuntimeInstance.java:730)
> at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:263)
> at org.apache.velocity.app.VelocityEngine.init(VelocityEngine.java:93)
> at org.codehaus.plexus.velocity.DefaultVelocityComponent.initialize(DefaultVelocityComponent.java:95)
> at org.eclipse.sisu.plexus.PlexusLifecycleManager.initialize(PlexusLifecycleManager.java:303)
> at org.eclipse.sisu.plexus.PlexusLifecycleManager.activate(PlexusLifecycleManager.java:207)
> at org.eclipse.sisu.bean.BeanScheduler$Pending.activate(BeanScheduler.java:156)
> at org.eclipse.sisu.bean.BeanScheduler$Activator.onProvision(BeanScheduler.java:185)
> at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:126)
> at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:68)
> at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:63)
> at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45)
> at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016)
> at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
> at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012)
> at org.eclipse.sisu.inject.Guice4$1.get(Guice4.java:162)
> at org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:81)
> at org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:51)
> at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:263)
> at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:255)
> at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:517)
> at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:121)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
> 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.buildProject(LifecycleModuleBuilder.java:116)
> at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
> at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
> at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
> at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
> at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> 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)
> Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.StringUtils
> at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
> at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
> at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
> at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
> ... 44 more
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 1.219 s
> [INFO] Finished at: 2017-02-23T17:56:33+01:00
> [INFO] Final Memory: 14M/155M
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.0.0:create-from-project
> (default-cli) on project EncodeDetectorLibrary: Execution default-cli
> of goal
> org.apache.maven.plugins:maven-archetype-plugin:3.0.0:create-from-project
> failed: A required class was missing while executing
> org.apache.maven.plugins:maven-archetype-plugin:3.0.0:create-from-project:
> org/apache/commons/lang/StringUtils
> [ERROR] -----------------------------------------------------
> [ERROR] realm = plugin>org.apache.maven.plugins:maven-archetype-plugin:3.0.0
> [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
> [ERROR] urls[0] = file:/C:/Users/Nylon/.m2/repository/org/apache/maven/plugins/maven-archetype-plugin/3.0.0/maven-archetype-plugin-3.0.0.jar
> [ERROR] urls[1] = file:/C:/Users/Nylon/.m2/repository/org/apache/maven/archetype/archetype-catalog/3.0.0/archetype-catalog-3.0.0.jar
> [ERROR] urls[2] = file:/C:/Users/Nylon/.m2/repository/org/apache/maven/archetype/archetype-descriptor/3.0.0/archetype-descriptor-3.0.0.jar
> [ERROR] urls[3] = file:/C:/Users/Nylon/.m2/repository/org/apache/maven/archetype/archetype-common/3.0.0/archetype-common-3.0.0.jar
> [ERROR] urls[4] = file:/C:/Users/Nylon/.m2/repository/net/sourceforge/jchardet/jchardet/1.0/jchardet-1.0.jar
> [ERROR] urls[5] = file:/C:/Users/Nylon/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.6/plexus-component-annotations-1.6.jar
> [ERROR] urls[6] = file:/C:/Users/Nylon/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar
> [ERROR] urls[7] = file:/C:/Users/Nylon/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar
> [ERROR] urls[8] = file:/C:/Users/Nylon/.m2/repository/jdom/jdom/1.0/jdom-1.0.jar
> [ERROR] urls[9] = file:/C:/Users/Nylon/.m2/repository/commons-io/commons-io/2.2/commons-io-2.2.jar
> [ERROR] urls[10] = file:/C:/Users/Nylon/.m2/repository/org/codehaus/plexus/plexus-velocity/1.1.8/plexus-velocity-1.1.8.jar
> [ERROR] urls[11] = file:/C:/Users/Nylon/.m2/repository/org/apache/velocity/velocity/1.7/velocity-1.7.jar
> [ERROR] urls[12] = file:/C:/Users/Nylon/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar
> [ERROR] urls[13] = file:/C:/Users/Nylon/.m2/repository/org/codehaus/groovy/groovy/1.8.3/groovy-1.8.3.jar
> [ERROR] urls[14] = file:/C:/Users/Nylon/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7.jar
> [ERROR] urls[15] = file:/C:/Users/Nylon/.m2/repository/asm/asm/3.2/asm-3.2.jar
> [ERROR] urls[16] = file:/C:/Users/Nylon/.m2/repository/asm/asm-commons/3.2/asm-commons-3.2.jar
> [ERROR] urls[17] = file:/C:/Users/Nylon/.m2/repository/asm/asm-util/3.2/asm-util-3.2.jar
> [ERROR] urls[18] = file:/C:/Users/Nylon/.m2/repository/asm/asm-analysis/3.2/asm-analysis-3.2.jar
> [ERROR] urls[19] = file:/C:/Users/Nylon/.m2/repository/asm/asm-tree/3.2/asm-tree-3.2.jar
> [ERROR] urls[20] = file:/C:/Users/Nylon/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.21/plexus-utils-3.0.21.jar
> [ERROR] urls[21] = file:/C:/Users/Nylon/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-6/plexus-interactivity-api-1.0-alpha-6.jar
> [ERROR] urls[22] = file:/C:/Users/Nylon/.m2/repository/org/sonatype/sisu/sisu-inject-bean/1.4.2/sisu-inject-bean-1.4.2.jar
> [ERROR] urls[23] = file:/C:/Users/Nylon/.m2/repository/org/sonatype/sisu/sisu-guice/2.1.7/sisu-guice-2.1.7-noaop.jar
> [ERROR] urls[24] = file:/C:/Users/Nylon/.m2/repository/org/sonatype/aether/aether-util/1.7/aether-util-1.7.jar
> [ERROR] urls[25] = file:/C:/Users/Nylon/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
> [ERROR] urls[26] = file:/C:/Users/Nylon/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
> [ERROR] urls[27] = file:/C:/Users/Nylon/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
> [ERROR] urls[28] = file:/C:/Users/Nylon/.m2/repository/org/apache/maven/shared/maven-invoker/2.2/maven-invoker-2.2.jar
> [ERROR] urls[29] = file:/C:/Users/Nylon/.m2/repository/org/apache/maven/shared/maven-artifact-transfer/0.9.0/maven-artifact-transfer-0.9.0.jar
> [ERROR] urls[30] = file:/C:/Users/Nylon/.m2/repository/org/apache/maven/shared/maven-common-artifact-filters/3.0.0/maven-common-artifact-filters-3.0.0.jar
> [ERROR] urls[31] = file:/C:/Users/Nylon/.m2/repository/org/apache/maven/shared/maven-shared-utils/3.0.0/maven-shared-utils-3.0.0.jar
> [ERROR] urls[32] = file:/C:/Users/Nylon/.m2/repository/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar
> [ERROR] urls[33] = file:/C:/Users/Nylon/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar
> [ERROR] urls[34] = file:/C:/Users/Nylon/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar
> [ERROR] urls[35] = file:/C:/Users/Nylon/.m2/repository/org/apache/maven/shared/maven-script-interpreter/1.0/maven-script-interpreter-1.0.jar
> [ERROR] urls[36] = file:/C:/Users/Nylon/.m2/repository/org/beanshell/bsh/2.0b4/bsh-2.0b4.jar
> [ERROR] urls[37] = file:/C:/Users/Nylon/.m2/repository/org/apache/ant/ant/1.8.1/ant-1.8.1.jar
> [ERROR] Number of foreign imports: 1
> [ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
> [ERROR]
> [ERROR] -----------------------------------------------------: org.apache.commons.lang.StringUtils
> [ERROR] -> [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/PluginContainerException